GuiGridListSetColumnWidth: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (OOP syntax)
 
(7 intermediate revisions by 5 users not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiGridListSetColumnWidth ( element gridList, int columnIndex, number width, [bool relative = true] )
bool guiGridListSetColumnWidth ( element gridList, int columnIndex, number width, bool relative )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:setColumnWidth}}


===Required Arguments===  
===Required Arguments===  
Line 12: Line 13:
*'''columnIndex:''' Column ID of the size you want to change
*'''columnIndex:''' Column ID of the size you want to change
*'''width:''' A float or integer of the width of the column depending on the '''relative''' argument.
*'''width:''' A float or integer of the width of the column depending on the '''relative''' argument.
===Optional Arguments===
{{OptionalArg}}
*'''relative:''' A boolean defining whether '''width''' measurements will be relative to the Gridlist size, or absolute pixels.
*'''relative:''' A boolean defining whether '''width''' measurements will be relative to the Gridlist size, or absolute pixels.


Line 21: Line 19:


==Example==  
==Example==  
This page lacks an example
This example creates a gridlist with one column that is too small to display. After the column has been successfully created, we give it a new width so you can see column.
<syntaxhighlight lang="lua">
<!-- Why these odd positions? Examples look cleaner with numbers like 250 instead of 249. Dunno whether I should change them.-->
--add an example here
<syntaxhighlight lang="lua">local gridlist = guiCreateGridList ( 332, 195, 286, 249, false )
local column = guiGridListAddColumn ( gridlist, "My column", 0 )
 
if column then
guiGridListSetColumnWidth ( gridlist, column, 0.5, true)
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{GUI functions}}
{{GUI functions}}
[[Category:Needs_Example]]
{{GUI_events}}

Latest revision as of 21:10, 7 November 2018

This allows you to set the width of an existing column in a gridlist.

Syntax

bool guiGridListSetColumnWidth ( element gridList, int columnIndex, number width, bool relative )

OOP Syntax Help! I don't understand this!

Method: GuiGridList:setColumnWidth(...)


Required Arguments

  • gridList: The grid list you want to add a column to
  • columnIndex: Column ID of the size you want to change
  • width: A float or integer of the width of the column depending on the relative argument.
  • relative: A boolean defining whether width measurements will be relative to the Gridlist size, or absolute pixels.

Returns

Returns true if the gridlist column width was successfully set, false if bad arguments were given.

Example

This example creates a gridlist with one column that is too small to display. After the column has been successfully created, we give it a new width so you can see column.

local gridlist = guiCreateGridList ( 332, 195, 286, 249, false ) 
local column = guiGridListAddColumn ( gridlist, "My column", 0 )

if column then
	guiGridListSetColumnWidth ( gridlist, column, 0.5, true)
end

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI