GuiGridListGetItemData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(OOP syntax)
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__  
{{Client function}}
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
__NOTOC__
This fake function is for use with blah & blah and does blahblahblabhalbhl
With this function you can retrieve the [[string]] data associated with an item in a [[Element/GUI/Gridlist|grid list]]. This is not the text that is displayed on the item, but an internal string that you can use to hold extra information about the item.<br/>
'''Note:''' This function will only work '''after''' you set the item's text using [[guiGridListSetItemText]]!


==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string guiGridListGetItemData ( element gridList, int rowIndex, int columnIndex )
var guiGridListGetItemData ( element gridList, int rowIndex, int columnIndex )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:getItemData}}


===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''gridList:''' the grid list containing the item you're interested in
*'''argumentName:''' description
*'''rowIndex:''' the row index of the item
 
*'''columnIndex:''' the column index of the item
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns the item data of the specified item if succesful, ''false'' if one of the arguments was invalid.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==
<!-- Explain what the example is in a single sentance -->
This example displays a random item data from the gridlist.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function clientsideResourceStart ()
blabhalbalhb --abababa
    local numberList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true )
--This line does this...
    local column = guiGridListAddColumn ( numberList, "Column Title", 0.85 )
mooo
    if ( column ) then
        local row = guiGridListAddRow ( numberList )
        local myItem = guiGridListSetItemText ( numberList, row, column, tostring( math.random(0, 10) ^ 100 ), false, false )
        local myItemData = guiGridListGetItemData ( numberList, row, column )
        outputChatBox ( "My gridlist item data: " .. myItemData )
    end
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{GUI functions}}
{{GUI functions}}
[[Category:Incomplete]]
{{GUI_events}}

Latest revision as of 21:19, 7 November 2018

With this function you can retrieve the string data associated with an item in a grid list. This is not the text that is displayed on the item, but an internal string that you can use to hold extra information about the item.
Note: This function will only work after you set the item's text using guiGridListSetItemText!

Syntax

var guiGridListGetItemData ( element gridList, int rowIndex, int columnIndex )

OOP Syntax Help! I don't understand this!

Method: GuiGridList:getItemData(...)


Required Arguments

  • gridList: the grid list containing the item you're interested in
  • rowIndex: the row index of the item
  • columnIndex: the column index of the item

Returns

Returns the item data of the specified item if succesful, false if one of the arguments was invalid.

Example

This example displays a random item data from the gridlist.

function clientsideResourceStart ()
    local numberList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true )
    local column = guiGridListAddColumn ( numberList, "Column Title", 0.85 )
    if ( column ) then
        local row = guiGridListAddRow ( numberList )
        local myItem = guiGridListSetItemText ( numberList, row, column, tostring( math.random(0, 10) ^ 100 ), false, false )
        local myItemData = guiGridListGetItemData ( numberList, row, column )
        outputChatBox ( "My gridlist item data: " .. myItemData )
    end
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )

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