Jump to content

get selected grid.


Recommended Posts

Hello, I dont know hoow i can use the guiGridListGetSelectedItem..

I have tried:

rGrid = guiCreateGridList(10,30,165,413,false,guiWindow) 
myGridGrid = guiGridListSetItemText(rGrid,0,1,"Trucker", false, false) 
addEventHandler ( "onClientGUIClick", guiRoot, 
    function ( button ) 
                local theGUI = guiGridListGetSelectedItem ( rGrid ) 
                   if ( theGUI == myGridGrid ) then 
                    outputChatBox ( "Hey!" ) 

Link to comment

return number values with select row and column ( in grid list ).


return boolean.

if ( theGUI == myGridGrid ) then 

This condition never be working.

Maybe you want check if play select row and column?

local nRow, nColumn = guiGridListGetSelectedItem( rGrid ) 
if nRow ~= -1 and nColumn ~= - 1 then -- Check if we select row and column 
-- TODO 

Edited by Guest
Link to comment

No, I have created several rows in my gridlist.

Let's say I have two rows, one with the name "Cookie" and another one with "Cereal" and if I click on the Cookie row it will output "Hello" but if I click on the "Cereal" item it will say "Bulldog"

Link to comment

Write conditions.

local sText = guiGridListGetItemText( guiGridListGetSelectedItem( rGrid ) ) -- get text 
if sText == 'Cookie' then -- check 
    outputChatBox 'Hello' 
elseif sText == 'Cereal' then -- check 
    outputChatBox 'Bulldog' 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...