<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Manve</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Manve"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Manve"/>
	<updated>2026-04-06T06:45:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListGetItemText&amp;diff=42122</id>
		<title>GuiGridListGetItemText</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListGetItemText&amp;diff=42122"/>
		<updated>2014-09-21T09:28:37Z</updated>

		<summary type="html">&lt;p&gt;Manve: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function retrieves the text from a specific grid list item.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string guiGridListGetItemText ( element gridList, int rowIndex, int columnIndex )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridList:''' the gridlist containing the item you're interested in&lt;br /&gt;
*'''rowIndex:''' row id of the item&lt;br /&gt;
*'''columnIndex:''' column id of the item&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the text of the item if the arguments are right, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1''': This example creates a gridlist with entries &amp;quot;Hello&amp;quot; and &amp;quot;World!&amp;quot; and chooses randomly which of these two grid list items it will retrieve.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function clientsideResourceStart ()&lt;br /&gt;
        --Create a gridlist&lt;br /&gt;
    	local myGridList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) &lt;br /&gt;
    	--Create columnA on the gridlist&lt;br /&gt;
		local columnA = guiGridListAddColumn ( myGridList, &amp;quot;columnA Title&amp;quot;, 0.85 ) &lt;br /&gt;
    	--Add 2 rows to the grid list&lt;br /&gt;
		rowA = guiGridListAddRow ( myGridList )&lt;br /&gt;
    	rowB = guiGridListAddRow ( myGridList )&lt;br /&gt;
        --Create the text &amp;quot;Hello&amp;quot; for rowA, columnA&lt;br /&gt;
		guiGridListSetItemText ( myGridList, rowA, columnA, &amp;quot;Hello&amp;quot;, false, false )   	&lt;br /&gt;
    	--Create the text &amp;quot;World!&amp;quot; for rowB, columnA&lt;br /&gt;
		guiGridListSetItemText ( myGridList, rowB, columnA, &amp;quot;World!&amp;quot;, false, false )&lt;br /&gt;
    	--Choose randomly which grid list item text to retrieve&lt;br /&gt;
        getRandomItem = math.random ( 1, 2 )       &lt;br /&gt;
		if getRandomItem == 1 then &lt;br /&gt;
                randomItemData = guiGridListGetItemText ( myGridList, rowA, columnA )&lt;br /&gt;
        elseif getRandomItem == 2 then&lt;br /&gt;
                randomItemData = guiGridListGetItemText ( myGridList, rowB, columnA )&lt;br /&gt;
        end&lt;br /&gt;
        --Output the randomly retrieved item text&lt;br /&gt;
        outputChatBox ( &amp;quot;My gridlist item text: &amp;quot;..randomItemData ) &lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, getRootElement(), clientsideResourceStart )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': This example creates a player list on resource start, clicking on it will output the selected player name to the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createPlayerList ()&lt;br /&gt;
        -- Create the grid list&lt;br /&gt;
        playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true )&lt;br /&gt;
        -- Create a players column in the list&lt;br /&gt;
        local column = guiGridListAddColumn( playerList, &amp;quot;Player&amp;quot;, 0.85 )&lt;br /&gt;
        if ( column ) then         -- If the column has been created, fill it with players&lt;br /&gt;
                for id, playeritem in ipairs(getElementsByType(&amp;quot;player&amp;quot;)) do&lt;br /&gt;
                        local row = guiGridListAddRow ( playerList )&lt;br /&gt;
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false )&lt;br /&gt;
                end&lt;br /&gt;
                addEventHandler ( &amp;quot;onClientGUIClick&amp;quot;, playerList, click )&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, getRootElement(), createPlayerList )&lt;br /&gt;
&lt;br /&gt;
function click () &lt;br /&gt;
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 )&lt;br /&gt;
       outputChatBox(playerName)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI functions}}&lt;/div&gt;</summary>
		<author><name>Manve</name></author>
	</entry>
</feed>