Stevenn Posted June 2, 2012 Share Posted June 2, 2012 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!" ) end end ) Link to comment
Kenix Posted June 2, 2012 Share Posted June 2, 2012 (edited) guiGridListGetSelectedItem return number values with select row and column ( in grid list ). guiGridListSetItemText 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 end Edited June 2, 2012 by Guest Link to comment
Stevenn Posted June 2, 2012 Author Share Posted June 2, 2012 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
Kenix Posted June 2, 2012 Share Posted June 2, 2012 Write conditions. local sText = guiGridListGetItemText( guiGridListGetSelectedItem( rGrid ) ) -- get text if sText == 'Cookie' then -- check outputChatBox 'Hello' elseif sText == 'Cereal' then -- check outputChatBox 'Bulldog' end Link to comment
Stevenn Posted June 2, 2012 Author Share Posted June 2, 2012 "bad argument, expected gui element at argument 1, got 0 " Link to comment
Tete omar Posted June 2, 2012 Share Posted June 2, 2012 So you must use addCommandHandler or bindKey so at least you make sense for your gui Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now