Jump to content

gridlist


TuRisMo

Recommended Posts

I want to know why when I press the button the item isn't getting added to the gridlist. Thanks

function addplaylist() 
        if guiGetText(edit1) ~= "" then 
            row = guiGridListAddRow(gridlist1) 
            guiGridListSetItemText(gridlist1, row, column1, guiGetText(edit1), false, false) 
            guiSetText(edit1,"") 
        end 
    end 
    addEventHandler(onClientGUIClick, button1, addplaylist()) 
  
    function removeplaylist() 
        if guiGridListGetSelectedItem(gridlist1) ~= -1 then 
            row, column = guiGridListGetSelectedItem(gridlist1) 
            guiGridListRemoveRow(gridlist1,row) 
        end 
    end 
    addEventHandler(onClientGUIClick, button6, removeplaylist())  

Edited by Guest
Link to comment
function addplaylist ( ) 
    if ( guiGetText ( edit1 ) ~= "" ) then 
        local row = guiGridListAddRow ( gridlist1 ) 
        guiGridListSetItemText ( gridlist1, row, column1, guiGetText ( edit1 ), false, false ) 
        guiSetText ( edit1, "" ) 
    end 
end 
addEventHandler ( "onClientGUIClick", button1, addplaylist, false ) 
  
function removeplaylist ( ) 
    if ( guiGridListGetSelectedItem ( gridlist1 ) ~= -1 ) then 
        local row, column = guiGridListGetSelectedItem ( gridlist1 ) 
        guiGridListRemoveRow ( gridlist1, row ) 
    end 
end 
addEventHandler ( "onClientGUIClick", button6, removeplaylist, false ) 

Error was here:

addEventHandler(onClientGUIClick, button1, addplaylist()) 
addEventHandler(onClientGUIClick, button6, removeplaylist())  

Should have been:

addEventHandler ( "onClientGUIClick", button1, addplaylist, false ) 
addEventHandler ( "onClientGUIClick", button6, removeplaylist, false ) 

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