• DermaMenu Active Tab
    6 replies, posted
I'm searching for a code that whenever you close your menu and open it back up its on the same tab as before. Anyone care to help me out?
[b][url=http://wiki.garrysmod.com/?title=DPropertySheet.GetActiveTab]DPropertySheet.GetActiveTab [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [b][url=http://wiki.garrysmod.com/?title=DPropertySheet.SetActiveTab]DPropertySheet.SetActiveTab [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE=josh980;34313505][b][url=http://wiki.garrysmod.com/?title=DPropertySheet.GetActiveTab]DPropertySheet.GetActiveTab [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [b][url=http://wiki.garrysmod.com/?title=DPropertySheet.SetActiveTab]DPropertySheet.SetActiveTab [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/QUOTE] Thank you. As well I was searching for DListView and sorting. All I found was this: List:SortByColumn(1) That did not sort my first column like the wiki said it would. [URL="http://wiki.garrysmod.com/?title=DListView.SortByColumn"]http://wiki.garrysmod.com/?title=DListView.SortByColumn[/URL] SetActiveTab doesn't work it returns as a nil value. GetActiveTab doesn't work either it returns nil aswell.
Post your code.
[QUOTE=Aide;34314247]Post your code.[/QUOTE] [lua] local DermaPanel, sheet1, sheet2 = nil, nil, nil function testDFrame() DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50, 50 ) DermaPanel:SetSize( 350, 400 ) DermaPanel:SetTitle( "Testing Derma Stuff" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( false ) DermaPanel:ShowCloseButton( true ) DermaPanel:MakePopup() local PropertySheet = vgui.Create( "DPropertySheet", DermaPanel ) PropertySheet:SetPos( 5, 30 ) PropertySheet:SetSize( 340, 315 ) local SheetItemOne = vgui.Create( "DCheckBoxLabel" ) SheetItemOne:SetText( "Use Props?" ) SheetItemOne:SetConVar( "some_convar" ) SheetItemOne:SetValue( 1 ) SheetItemOne:SizeToContents() local SheetItemTwo = vgui.Create( "DCheckBoxLabel" , CategoryContentTwo ) SheetItemTwo:SetText( "Use SENTs?" ) SheetItemTwo:SetConVar( "some_convar" ) SheetItemTwo:SetValue( 1 ) SheetItemTwo:SizeToContents() local sheet1 = PropertySheet:AddSheet( "Some Menu", SheetItemOne, "gui/silkicons/user", false, false, "WOW It's a text box!!!" ) local sheet2 = PropertySheet:AddSheet( "Super Menu", SheetItemTwo, "gui/silkicons/group", false, false, "Can I haz meh cheezburger now?" ) DermaPanel:SetActiveTab( sheet2.Tab ) end concommand.Add("open", testDFrame) [/lua] This is directly from the wiki.
The SetActiveTab() works on a PropertySheet. Instead of "DermaPanel:SetActiveTab( sheet2.Tab)" do "PropertySheet:SetActiveTab( sheet2.Tab)".
[QUOTE=wizardsbane;34315317]The SetActiveTab() works on a PropertySheet. Instead of "DermaPanel:SetActiveTab( sheet2.Tab)" do "PropertySheet:SetActiveTab( sheet2.Tab)".[/QUOTE] Thanks i'll try that :D [editline]20th January 2012[/editline] [QUOTE=brandonj4;34316435]Thanks i'll try that :D[/QUOTE] Thanks but it didnt work.. [lua] local Sheet1 = Sheet:AddSheet( "Entities", EntitiesPanel, "gui/silkicons/user", false, false, "Supplies!" ) local Sheet2 = Sheet:AddSheet( "PlayerInfo", ScoreBoard, "gui/silkicons/user", false, false, "Player Information!" ) if Sheet:GetActiveTab( )==Sheet1 then Sheet:SetActiveTab( Sheet1.Tab ) elseif Sheet:GetActiveTab( )==Sheet2 then Sheet:SetActiveTab( Sheet2.Tab ) end [/lua] This is the other code that doesnt show the active tab is actually it. It only shows the one thats NOT active. [lua] if Sheet:GetActiveTab( )==Sheet2 then print( " The active tab is 'Super Menu'." ) else print( "The active tab is NOT 'Super Menu'." ) end [/lua]
Sorry, you need to Log In to post a reply to this thread.