DListView Column/SetFixedWidth

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added SetFixedWidth page (with example))
 
Line 25: Line 25:
 
SimpleList:AddLine( "First", "Column" )
 
SimpleList:AddLine( "First", "Column" )
 
SimpleList:AddLine( "Second", "Column" )
 
SimpleList:AddLine( "Second", "Column" )
 +
|Output=<br/><br/>
 +
[[Image:DListView_Column_SetFixedWidth.png]]
 
}}
 
}}

Revision as of 11:02, 8 September 2019

 DListView_Column:SetFixedWidth( )

Contents

DescriptionPanelFunc

Sets the fixed width of the column.

Arguments

number width

The number value which will determine a fixed 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 will be longer than the second column.

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" )
SimpleList:AddColumn( "Column 2" ):SetFixedWidth(125)

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

Output:



DListView Column SetFixedWidth.png
Personal tools
Navigation