TuRisMo Posted December 10, 2012 Posted December 10, 2012 (edited) 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 December 10, 2012 by Guest
Castillo Posted December 10, 2012 Posted December 10, 2012 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 )
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