DListView Column/SetWidth

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added SetWidth page (with example))
 
 
Line 26: Line 26:
 
SimpleList:AddLine( "First", "Column" )
 
SimpleList:AddLine( "First", "Column" )
 
SimpleList:AddLine( "Second", "Column" )
 
SimpleList:AddLine( "Second", "Column" )
 +
|Output=[[Image:DListView_Column_SetWidth.png]]
 
}}
 
}}

Latest revision as of 11:07, 8 September 2019

 DListView_Column:SetWidth( )

Contents

DescriptionPanelFunc

Sets the width of the panel.

Arguments

number width

The number value which will determine panel width.

Examples

Example

Creates a DListView and populates it with two columns and two items, only one of which can be selected at a time.

The first column width is 15. The second column width is 350.

local Frame = vgui.Create( "DFrame" )
Frame:SetSize( 500, 500 )
Frame:Center()
Frame:MakePopup()

local SimpleList = vgui.Create( "DListView", Frame )
SimpleList:Dock( FILL )
SimpleList:SetMultiSelect( false )

SimpleList:AddColumn( "Column 1" ):SetWidth(15)
SimpleList:AddColumn( "Column 2" ):SetWidth(350)

SimpleList:AddLine( "First", "Column" )
SimpleList:AddLine( "Second", "Column" )

Output:

DListView Column SetWidth.png
Personal tools
Navigation