DListView Column/SetMaxWidth

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added SetMaxWidth page (with example))
 
m (Changed word "max" to "maximum")
Line 1: Line 1:
 
{{PanelFunc
 
{{PanelFunc
|Description=Sets the max width of a column.
+
|Description=Sets the maximum width of a column.
 
}}
 
}}
 
{{Arg
 
{{Arg

Revision as of 08:40, 8 September 2019

 DListView_Column:SetMaxWidth( )

Contents

DescriptionPanelFunc

Sets the maximum width of a column.

Arguments

number width

The number value which will determine a maximum 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 second column can't be bigger than the argument value.

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" ):SetMaxWidth(225)

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


Personal tools
Navigation