Jump to content

[GUI] onClientClick for Gridlist


Recommended Posts

If they click on something in the list, it will call a function right away which in turn will load more information to display off to the side about what I have selected.

The main part is getting the function to trigger just by clicking on the glidlist item.

Link to comment

Yes.. Here is a little example that I made

local g = guiCreateGridList ( 0, 0, 100, 100, false ) 
guiGridListAddColumn ( g, "Column", 1 ) 
  
for i=1, 100 do  
    local r = guiGridListAddRow ( g ) 
    guiGridListSetItemText ( g, r, 1, tostring ( i ), false, false ) 
end 
  
  
addEventHandler ( "onClientGUIClick", g, function ( )  
    local r, c = guiGridListGetSelectedItem ( source ) 
    outputChatBox ( "You selected ".. tostring ( guiGridListGetItemText ( g, r, 1 ) ) ) 
end ) 

Link to comment
Yes.. Here is a little example that I made
local g = guiCreateGridList ( 0, 0, 100, 100, false ) 
guiGridListAddColumn ( g, "Column", 1 ) 
  
for i=1, 100 do  
    local r = guiGridListAddRow ( g ) 
    guiGridListSetItemText ( g, r, 1, tostring ( i ), false, false ) 
end 
  
  
addEventHandler ( "onClientGUIClick", g, function ( )  
    local r, c = guiGridListGetSelectedItem ( source ) 
    outputChatBox ( "You selected ".. tostring ( guiGridListGetItemText ( g, r, 1 ) ) ) 
end ) 

Thanks!

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...