AGENT_STEELMEAT Posted March 26, 2011 Share Posted March 26, 2011 Hey, I'm having trouble getting onClientGUIDoubleClick to trigger. When a user double clicks a row in the gridlist (taxiGridList), it should output the ID number (column 1) to the chatbox (as a test). It's not doing anything atm. Any ideas? http://pyropaste.com/Q3a25c11V Link to comment
Castillo Posted March 26, 2011 Share Posted March 26, 2011 Try this, function buildWindow() mainWindow = guiCreateWindow(getX(25), getY(25), getX(50), getY(50), "Double-click a destination!", false) guiWindowSetSizable(mainWindow,false) guiWindowSetMovable(mainWindow,false) guiSetVisible(mainWindow, false) taxiGridList = guiCreateGridList(getX(1), getY(2), getX(48), getY(47), false, mainWindow) guiGridListSetSortingEnabled ( taxiGridList, false ) guiGridListAddColumn(taxiGridList,"ID",0.05) guiGridListAddColumn(taxiGridList,"Description",0.-- s8) --> guiGridListAddColumn(taxiGridList,"Rate",0.13) addEventHandler( "onClientGUIDoubleClick", taxiGridList, submitTaxi, false) end addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource() ), buildWindow) function toggleTaxiWindow() if (guiGetVisible(mainWindow) == true) then guiSetVisible(mainWindow, false) showCursor(false) guiGridListClear(taxiGridList) else guiSetVisible(mainWindow, true) showCursor(true) triggerServerEvent("requestDestinations",getLocalPlayer()) end end bindKey("F2","down",toggleTaxiWindow) --Accepts the info from the server, adds to the gridlist. Event isnt triggered by this function. function populateGridList(id, name) local row = guiGridListAddRow(taxiGridList) guiGridListSetItemText ( taxiGridList, row, 1, tostring(id), false, false ) guiGridListSetItemText ( taxiGridList, row, 2, tostring(name), false, false ) guiGridListSetItemText ( taxiGridList, row, 3, "$1 / 20 KM", false, false ) end addEvent("receiveDestinations", true) addEventHandler("receiveDestinations", getRootElement(), populateGridList) function submitTaxi( button, state, sx, sy, x, y, z, elem, gui ) if ( source == taxiGridList and state == "down") then destId= guiGridListGetItemText (taxiGridList, guiGridListGetSelectedItem (taxiGridList), 1) outputChatBox(tostring(destId)) end end 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