DPropertySheet.SizeToContentWidth
From GMod Wiki
Function | |
Syntax | DPropertySheet:SizeToContentWidth( ) |
Description: | |
Sizes the width of the DPropertySheet to fit it's contents. | |
Returns: | Nil |
In Object: | DPropertySheet |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=DPropertySheet.SizeToContentWidth]DPropertySheet.SizeToContentWidth [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Creates a DPropertySheet and sizes it's width to match that of it's contents |
---|---|
Used on | |
Code | local 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 sheet1 = PropertySheet:AddSheet( "Tab 1", SheetItemOne, "gui/silkicons/user", false, false, "Tooltip 1" ) DermaPanel:SizeToContentWidth() end |
Output | DPropertySheet sized to match the width of it's contents |
Additional Notes
- This is comparable to the SizeToContents function, but this one only works in one direction.
- Do not put this in a Paint or Think function, as it will probably lag badly if you have multiple of these hooks.