kuwalda Posted July 5, 2014 Share Posted July 5, 2014 This script is kinda messy because I am still working on it, but my main question is - why "guiGridListGetSelectedItem" dosen`t work for me? function blueBerryGoverment() sexy = guiCreateWindow(192, 123, 209, 353, "Job list", false) joblist = guiCreateGridList(10, 185, 190, 109, false, sexy) guiGridListAddColumn(joblist, "Job", 0.9) for i = 1, 4 do guiGridListAddRow(joblist) end guiGridListSetItemText(joblist, 0, 1, "Job1", false, false) guiGridListSetItemText(joblist, 1, 1, "Job2", false, false) guiGridListSetItemText(joblist, 2, 1, "Job3", false, false) guiGridListSetItemText(joblist, 3, 1, "Job4", false, false) sexy2 = guiCreateWindow(401, 123, 209, 353, "Second tab", false) guiSetVisible(sexy2,false) end addEvent("requestblueBerryGoverment", true) addEventHandler("requestblueBerryGoverment", getRootElement(), blueBerryGoverment) --this part is not working. Why? addEventHandler( "onClientGUIClick", joblist, function(button, state, absoluteX, absoluteY) if guiGridListGetSelectedItem(source) == "Job1" then if (button == 'left') then guiSetVisible(sexy2,true) end end end ) Link to comment
Max+ Posted July 5, 2014 Share Posted July 5, 2014 function blueBerryGoverment() sexy = guiCreateWindow(192, 123, 209, 353, "Job list", false) joblist = guiCreateGridList(10, 185, 190, 109, false, sexy) guiGridListAddColumn(joblist, "Job", 0.9) for i = 1, 4 do guiGridListAddRow(joblist) end guiGridListSetItemText(joblist, 0, 1, "Job1", false, false) guiGridListSetItemText(joblist, 1, 1, "Job2", false, false) guiGridListSetItemText(joblist, 2, 1, "Job3", false, false) guiGridListSetItemText(joblist, 3, 1, "Job4", false, false) sexy2 = guiCreateWindow(401, 123, 209, 353, "Second tab", false) guiSetVisible(sexy2,false) end addEvent("requestblueBerryGoverment", true) addEventHandler("requestblueBerryGoverment", getRootElement(), blueBerryGoverment) --this part is not working. Why? addEventHandler( "onClientGUIClick", root, function( ) if ( source == joblist ) then local row, col = guiGridListGetSelectedItem ( joblist ) if ( row == -1 ) then return end local text = guiGridListGetItemText ( joblist, row, col ) if ( text == 'Job1' ) then ---do Something elseif ( text == 'Job2' ) then ---do Something elseif ( text == 'Job3' ) then ---do Something elseif ( text == 'Job4' ) then ---do Something end end end ) 1 Link to comment
kuwalda Posted July 5, 2014 Author Share Posted July 5, 2014 Thanks for your quick reply, got it now! Link to comment
Max+ Posted July 5, 2014 Share Posted July 5, 2014 Your , welcome try study the code, 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