Garry's Mod Wiki

DPropertySheet:AddSheet

  table DPropertySheet:AddSheet( string name, Panel pnl, string icon = nil, boolean noStretchX = false, boolean noStretchY = false, string tooltip = nil )

Description

Adds a new tab.

Arguments

1 string name
Name of the tab
2 Panel pnl
Panel to be used as contents of the tab. This normally should be a DPanel
3 string icon = nil
Icon for the tab. This will ideally be a silkicon, but any material name can be used.
4 boolean noStretchX = false
Should DPropertySheet try to fill itself with given panel horizontally.
5 boolean noStretchY = false
Should DPropertySheet try to fill itself with given panel vertically.
6 string tooltip = nil
Tooltip for the tab when user hovers over it with his cursor

Returns

1 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

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")