GetRowFromItemText: Difference between revisions
Jump to navigation
Jump to search
(Created page with "This function enables you to get row from gridlist by using itemtext. ==Syntax== <syntaxhighlight lang="lua">int getRowFromItemText ( element gridList, string itemText [, int column] )</syntaxhighlight> ...") |
(→Code) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Useful Function}} | |||
__NOTOC__ | |||
This function enables you to get row from gridlist by using itemtext. | This function enables you to get row from gridlist by using itemtext. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int getRowFromItemText ( element gridList, string itemText [, int column] )</syntaxhighlight> | <syntaxhighlight lang="lua">int getRowFromItemText ( element gridList, string itemText [, int column] )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
* '''gridList''': The gridlist you want to get the row from. | * '''gridList''': The gridlist you want to get the row from. | ||
* '''itemText''': The itemtext of the row. | * '''itemText''': The itemtext of the row. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
* '''column''': The column you want to check the itemtext on. | * '''column''': The column you want to check the itemtext on. | ||
===Returns=== | ===Returns=== | ||
Returns row if successful, false otherwise. | Returns row if successful, false otherwise. | ||
Line 15: | 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