Jump to content

onClientGUIDoubleClick issues


Recommended Posts

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

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