GetRowFromItemText: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→Code) |
||
Line 20: | Line 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getRowFromItemText ( list, name, colum ) | function getRowFromItemText ( list, name, colum ) | ||
if ( isElement(list) ) and ( getElementType(list) == "gui-gridlist" ) ( type(name) == "string" ) then | if ( isElement(list) ) and ( getElementType(list) == "gui-gridlist" ) and ( type(name) == "string" ) then | ||
local colum = tonumber(colum) or 1 | local colum = tonumber(colum) or 1 | ||
local rows = guiGridListGetRowCount ( list ) - 1 | local rows = guiGridListGetRowCount ( list ) - 1 |
Latest revision as of 09:23, 24 March 2013
This function enables you to get row from gridlist by using itemtext.
Syntax
int getRowFromItemText ( element gridList, string itemText [, int column] )
Required Arguments
- gridList: The gridlist you want to get the row from.
- itemText: The itemtext of the row.
Optional Arguments
- column: The column you want to check the itemtext on.
Returns
Returns row if successful, false otherwise.
Code
Click to collapse [-]
Function sourcefunction getRowFromItemText ( list, name, colum ) if ( isElement(list) ) and ( getElementType(list) == "gui-gridlist" ) and ( type(name) == "string" ) then local colum = tonumber(colum) or 1 local rows = guiGridListGetRowCount ( list ) - 1 for i=0,rows do local text = guiGridListGetItemText ( list, i, colum ) if ( text == name ) then return i end end end return false end
Author: Bssol