BeCooL Posted August 16, 2013 Share Posted August 16, 2013 hi guys , i need help :\ , what is the problem ? GUIEditor = { gridlist = {}, window = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(284, 101, 730, 555, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(11, 21, 709, 480, false, GUIEditor.window[1]) col = guiGridListAddColumn(GUIEditor.gridlist[1], "Support", 0.9) GUIEditor.edit[1] = guiCreateEdit(9, 504, 705, 41, "", false, GUIEditor.window[1]) guiSetVisible ( GUIEditor.window[1] ,false ) end ) bindKey ( "J" , "down" , function() if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then guiSetVisible ( GUIEditor.window[1] ,false ) showCursor (false ) elseif ( guiGetVisible ( GUIEditor.window[1] ) == false ) then guiSetVisible ( GUIEditor.window[1] ,true ) showCursor (true ) end end ) bindKey ( "enter" , "down" , function() if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then Text = guiGetText ( GUIEditor.edit[1] ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, col, Text, false, false ) end end ) Link to comment
tosfera Posted August 16, 2013 Share Posted August 16, 2013 Any error's? Or what doesn't work? Link to comment
BeCooL Posted August 16, 2013 Author Share Posted August 16, 2013 Any error's? Or what doesn't work? there's no errors at /debugscript 3 , the problem when i press enter it's doesn't work Link to comment
Castillo Posted August 16, 2013 Share Posted August 16, 2013 You should use the event: "onClientGUIAccepted". GUIEditor = { gridlist = {}, window = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(284, 101, 730, 555, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(11, 21, 709, 480, false, GUIEditor.window[1]) col = guiGridListAddColumn(GUIEditor.gridlist[1], "Support", 0.9) GUIEditor.edit[1] = guiCreateEdit(9, 504, 705, 41, "", false, GUIEditor.window[1]) addEventHandler ( "onClientGUIAccepted", GUIEditor.edit[1], updateGridList, false ) guiSetVisible ( GUIEditor.window[1] ,false ) end ) bindKey ( "J" , "down", function ( ) local state = ( not guiGetVisible ( GUIEditor.window[1] ) ) guiSetVisible ( GUIEditor.window[1], state ) showCursor ( state ) end ) function updateGridList ( ) local Text = guiGetText ( GUIEditor.edit[1] ) if ( Text ~= "" ) then local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, col, Text, false, false ) end end Link to comment
BeCooL Posted August 16, 2013 Author Share Posted August 16, 2013 Thanks , how to clear the edit after pressing enter ? 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