• DCollapsibleCategory being weird
    1 replies, posted
EDIT: Fixed again by the amazing Boxama. Locking. EDIT: The main derma panel these open on is a Derma Panel connected to a DProperty Sheet. No idea if that is the problem. For some reason this code does not work as it should: [code] TheListPanel = vgui.Create( "DPanelList", SheetItemTwo ) TheListPanel:SetTall( SheetItemTwo:GetTall() *.975 ) TheListPanel:SetWide( SheetItemTwo:GetWide() *.975 ) TheListPanel:Center() TheListPanel:EnableVerticalScrollbar( true ) TheListPanel:EnableHorizontal( true ) Category = vgui.Create( "DCollapsibleCategory" ) Category:SetSize( TheListPanel:GetWide() *.965, TheListPanel:GetTall() *.925 ) Category:SetPos(0,TheListPanel:GetTall() *.25) Category:SetLabel( "s" ) CategoryList = vgui.Create( "DPanelList" ) CategoryList:SetTall( TheListPanel:GetTall() *.95 ) CategoryList:SetWide( TheListPanel:GetWide() *.975 ) CategoryList:EnableVerticalScrollbar( true ) CategoryList:SetSpacing(5) CategoryList:EnableHorizontal( true ) for k, v in pairs(CWRP_Craftables) do local ItemList = vgui.Create("DPanel") ItemList:SetTall( TheListPanel:GetTall() *.6 ) ItemList:SetWide( TheListPanel:GetWide() ) ItemList:SetPos( 0, 0 ) ItemList.Paint = function() draw.RoundedBox(8,0,2,ItemList:GetWide(),ItemList:GetTall(),Color( 100, 101, 100, 255 )) end local ItemBackground = vgui.Create( "DPanel", ItemList ) ItemBackground:SetPos( 0, 2 ) ItemBackground:SetSize( ItemList:GetWide(), ItemList:GetTall() ) ItemBackground.Paint = function() draw.RoundedBox(8,0,2,ItemBackground:GetWide(),ItemBackground:GetTall(),Color( 80, 81, 80, 255 )) end CategoryList:AddItem(ItemList) end Category:SetContents(CategoryList) TheListPanel:AddItem(Category) [/code] Opening the panel results in this: [IMG]http://s11.postimg.org/f46q1dgbn/image.png[/IMG] Collapsing the category and reopening it results in this: [IMG]http://s1.postimg.org/d5cc2xgnj/image.png[/IMG] Collapsing it and reopening again results in this: [IMG]http://s9.postimg.org/ikjc2d7hr/image.png[/IMG] This is very strange, am I doing this right?
Anyone?
Sorry, you need to Log In to post a reply to this thread.