DPropertySheet/AddSheet

From Garry's Mod
Jump to: navigation, search
 DPropertySheet:AddSheet( )

Contents

DescriptionPanelFunc

Adds a new tab.

Arguments

string name

Name of the tab

Arguments

Panel pnl

Panel to be used as contents of the tab. This normally should be a DPanel

Arguments

string icon=nil

Icon for the tab. This will ideally be a silkicon, but any material name can be used.

Arguments

boolean noStretchX=false

Should DPropertySheet try to fill itself with given panel horizontally.

Arguments

boolean noStretchY=false

Should DPropertySheet try to fill itself with given panel vertically.

Arguments

string tooltip=nil

Tooltip for the tab when user hovers over it with his cursor

Returns

table

A table containing the following keys:

  • Panel Tab - The created DTab.
  • string Name - Name of the created tab
  • Panel Panel - The contents panel of the tab

Examples

Example

local frame = vgui.Create("DFrame")
frame:SetSize( ScrW() / 2, ScrH() / 2 )
frame:SetTitle( "Test Frame" )
frame:MakePopup()
frame:Center()

local tabs = vgui.Create( "DPropertySheet", frame )
tabs:Dock( FILL )

local tab1panel = vgui.Create( "DPanel" )

local SheetItem = vgui.Create( "DButton", tab1panel )
SheetItem:SetText( "Suicide" )
SheetItem:SetConsoleCommand( "kill" )
 
tabs:AddSheet( "Tab 1", tab1panel, "icon16/user.png", false, false, "Description of first tab")


Personal tools
Navigation