Jump to content

guiGridListGetSelectedItem


kuwalda

Recommended Posts

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

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 
) 
  
  • Like 1
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...