GuiGridListGetColumnCount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Added example)
m (Example)
Line 24: Line 24:
if columns < 1 then
if columns < 1 then
outputChatBox("There are no columns.")
outputChatBox("There are no columns.")
elseif columns > 1 then
elseif columns >= 1 then
outputChatBox("There are " .. tostring(columns) .. " columns.")
outputChatBox("There are " .. tostring(columns) .. " columns.")
else
else

Revision as of 07:14, 27 June 2016

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