DListView Column.SetFixedWidth

From GMod Wiki

Jump to: navigation, search
Function
Syntax DListView_Column:SetWidth( Integer width )
Description:
Sets the fixed width of the column
Returns: nil
In Object: DListView_Column
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DListView Column.SetFixedWidth]DListView Column.SetFixedWidth [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



DescriptionCreate a Derma ListView and add 3 fixed-width columns
Used onNewerClient.png
Code
 
	local sizew = 350;
	local sizeh = 60;
	local playerlist = vgui.Create( "DListView" );
 
	playerlist:SetParent( panel );
	playerlist:SetPos( 10, 30 );
	playerlist:SetMultiSelect( false );
	playerlist:AddColumn( "UserID" ):SetFixedWidth( 40 );
	playerlist:AddColumn( "Player" ):SetFixedWidth( 145 );
	playerlist:AddColumn( "SteamID" ):SetFixedWidth( 145 );
 
	for _, V in pairs( player.GetAll() ) do
		if( V != LocalPlayer() ) then
			table.insert( players, V:SteamID() );
			playerlist:AddLine( V:EntIndex(), V:Nick(), V:SteamID() );
			sizeh = sizeh + 16.7
		end
	end
 
	playerlist:SetSize( sizew - 20, sizeh - 40 );
 
OutputN/A

Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox