DPropertySheet.SetActiveTab

From GMod Wiki

Jump to: navigation, search
Function
Syntax DPropertySheet:SetActiveTab( Panel panel )
Description:
Sets the active tab, since DPropertySheet:AddSheet returns a table, you must use they 'Tab' key from that table or you will get an error
Returns: nil
In Object: DPropertySheet
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DPropertySheet.SetActiveTab]DPropertySheet.SetActiveTab [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionCreates a new screen and switches to the 2nd tab when it's created.
Used onNewerClient.png
Code
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()
 
	sheet1 = PropertySheet:AddSheet( "Some Menu", SheetItemOne, "gui/silkicons/user", false, false, "WOW It's a text box!!!" )
	sheet2 = PropertySheet:AddSheet( "Super Menu", SheetItemTwo, "gui/silkicons/group", false, false, "Can I haz meh cheezburger now?" )
 
	DermaPanel:SetActiveTab( sheet2.Tab )
end
 
 
OutputA Screen with 2 tabs where the second tab is selected.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox