• DScrollPanel not showing up for certain players
    2 replies, posted
Hello guys, I was wondering if someone could help me figure out what's going on. I have some code for a custom scoreboard, but a specific ScrollPanel is not working for some players, while it does for most. Here's the code for that specific part: [code] -------[Team 1]--------- local team_1_header = vgui.Create("DPanel", frame) team_1_header:SetSize(frame:GetWide(), 50) team_1_header:SetPos(0,host_dpanel:GetTall()+height-150) team_1_header.Paint = function() draw.RoundedBox(0,0,0,team_1_header:GetWide(),team_1_header:GetTall(),Color(0,0,0,100)) draw.DrawText("Spectators", "NexaLight35",5,10, Color(255, 255, 255, 255),TEXT_ALIGN_LEFT) end local team_1_panel = vgui.Create("DPanel", frame) team_1_panel:SetPos(0,host_dpanel:GetTall()+height-150+team_1_header:GetTall()) team_1_panel:SetSize(team_1_header:GetWide(),26) team_1_panel.Paint = function() draw.RoundedBox(0,0,0,team_1_panel:GetWide(),team_1_panel:GetTall(),Color(119, 119, 119,150)) draw.DrawText("NAME", "NexaLight20",5,5, Color(255, 255, 255, 255),TEXT_ALIGN_LEFT) draw.DrawText("PING", "NexaLight20",team_1_panel:GetWide()-30,5, Color(255, 255, 255, 255),TEXT_ALIGN_RIGHT) draw.RoundedBox(0,0,25,team_1_panel:GetWide(),1,Color(255,255,255,150)) end local team_1_scroll = vgui.Create("DScrollPanel", frame) team_1_scroll:SetPos(0,host_dpanel:GetTall()+height-150+team_1_header:GetTall()+team_1_panel:GetTall()) team_1_scroll:SetSize(team_1_header:GetWide(),height-550) team_1_scroll.Paint = function() draw.RoundedBox(0,0,0,team_1_scroll:GetWide(),team_1_scroll:GetTall(),Color(119,119,119,150)) end local num = 0 for k, v in pairs(team.GetPlayers(1002)) do local nick_lbl = vgui.Create("DButton", team_1_scroll) nick_lbl:SetText("") nick_lbl:SizeToContents() nick_lbl:SetSize(team_1_panel:GetWide(),30) nick_lbl:SetPos(0,num*nick_lbl:GetTall()) nick_lbl.Paint = function() draw.DrawText(v:Nick(), "NexaLight20",5,5, Color(255, 255, 255, 255),TEXT_ALIGN_LEFT) draw.DrawText(v:Ping(), "NexaLight20",team_1_panel:GetWide()-45,5,Color(255, 255, 255, 255),TEXT_ALIGN_RIGHT) end num = num + 1 nick_lbl.DoClick = function() if LocalPlayer():IsUserGroup("trialadmin") or LocalPlayer():IsAdmin() then local parentMenu = DermaMenu() local subMenu, parentMenuOption = parentMenu:AddSubMenu( "Change Player Team" ) local blueOption = subMenu:AddOption( "Blue", function() v:ConCommand("set_team "..v:EntIndex().." 2") end ) local redOption = subMenu:AddOption( "Red", function() v:ConCommand("set_team "..v:EntIndex().." 3") end ) --local spectatorOption = subMenu:AddOption( "Spectator", function() v:ConCommand("set_team "..v:EntIndex().." 1002") end ) parentMenu:Open() end end end ------------------------- [/code] This is the specific part that's not working: [code] local team_1_scroll = vgui.Create("DScrollPanel", frame) team_1_scroll:SetPos(0,host_dpanel:GetTall()+height-150+team_1_header:GetTall()+team_1_panel:GetTall()) team_1_scroll:SetSize(team_1_header:GetWide(),height-550) team_1_scroll.Paint = function() draw.RoundedBox(0,0,0,team_1_scroll:GetWide(),team_1_scroll:GetTall(),Color(119,119,119,150)) end [/code] Here's how the menu should look: [IMG]http://i885.photobucket.com/albums/ac59/Greene1200/2016-01-24_zpsapwdcdit.png[/IMG] And here's how it looks for some players: [IMG]http://images.akamai.steamusercontent.com/ugc/364031813832400423/2AF88912A196D39325229D95ACFEDF73732EA1EE/[/IMG] You can see the gray panel on the bottom has gone missing. I use the exact same code for the blue/red panels, which work for everyone. There are no error logs, it's just a really weird problem. I'm also using the exact same code to draw some other elements (ofc, changing the names of the elements), which are displaying for all of the players. Please help! [editline]25th January 2016[/editline] UPDATE: Apparently, the issue has to do with the client's screen resolution. The question now is... WHY?
[QUOTE=Heracles421;49607334] UPDATE: Apparently, the issue has to do with the client's screen resolution. The question now is... WHY?[/QUOTE] Because scroll panels resize to fit the screen resolution? That could make the other panels change position to fit
[QUOTE=MPan1;49607824]Because scroll panels resize to fit the screen resolution? That could make the other panels change position to fit[/QUOTE] I believe that depends on the way you code your panels
Sorry, you need to Log In to post a reply to this thread.