GuiGridListGetColumnCount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This allows you to get the count of existing columns in a gridlist. ==Syntax== <syntaxhighlight lang="lua"> int guiGridListGetColumnCount ( element gridList ) <...")
 
m (Added example)
Line 15: Line 15:


==Example==  
==Example==  
This page lacks an example
This example outputs number of columns in gridList to chatBox when player uses command ''getColumns''.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--add an example here
addCommandHandler("getColumns",
function(command)
 
local columns = guiGridListGetColumnCount(theGridList)
 
if columns < 1 then
outputChatBox("There are no columns.")
elseif columns > 1 then
outputChatBox("There are " .. tostring(columns) .. " columns.")
else
outputChatBox("Unable to get number of columns.")
end
end)
 
</syntaxhighlight>
</syntaxhighlight>


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

Revision as of 14:31, 29 February 2012

This allows you to get the count of existing columns in a gridlist.

Syntax

int guiGridListGetColumnCount ( element gridList )

Required Arguments

  • gridList: The grid list you want to add a column to

Returns

Returns an integer with the amount of columns in the gridlist, false otherwise.

Example

This example outputs number of columns in gridList to chatBox when player uses command getColumns.

addCommandHandler("getColumns",
function(command)

local columns = guiGridListGetColumnCount(theGridList)

if columns < 1 then
	outputChatBox("There are no columns.")
elseif columns > 1 then
	outputChatBox("There are " .. tostring(columns) .. " columns.")
else
	outputChatBox("Unable to get number of columns.")
	
end	
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