Jump to content

GridListGetSelectedItem


Recommended Posts

function MarkerHit (localPlayer, dimensao)
	janelaEmpregos = DGS:dgsCreateWindow (0.015, 0.18, 0.3, 0.3, "Empregos", true)
    DGS:dgsWindowSetCloseButtonEnabled(janelaEmpregos, false)
    showCursor(true)
    DGS:dgsSetInputMode("no_binds_when_editing")
    DGS:dgsWindowSetSizable(janelaEmpregos, false)

    local listaEmpregos = DGS:dgsCreateGridList (0.05, 0.03, 0.9, 0.75, true, janelaEmpregos)
    local coluna1 = DGS:dgsGridListAddColumn(listaEmpregos, "Emprego", 0.5) 
    local coluna2 = DGS:dgsGridListAddColumn(listaEmpregos, "Localização", 0.5) 

    DGS:dgsGridListAddRow(listaEmpregos, 1, "Entregador de Pizza", "San Fierro")
    DGS:dgsGridListAddRow(listaEmpregos, 2, "Camionista", "San Fierro")
    DGS:dgsGridListAddRow(listaEmpregos, 3, "Entregador de Pizza", "San Fierro")
    
    buttonC = DGS:dgsCreateButton(0.60, 0.815, 0.25, 0.15, "Cancelar", true, janelaEmpregos)
    addEventHandler ("onDgsMouseClick", buttonC, cancelamentoJanelaEmpregos)
    buttonE = DGS:dgsCreateButton(0.15, 0.815, 0.25, 0.15, "Escolher", true, janelaEmpregos)
    addEventHandler ("onDgsMouseClick", buttonE, escolhaJanelaEmpregos) 
end
addEventHandler ( "onClientMarkerHit", agenciaEmpregos, MarkerHit )

function cancelamentoJanelaEmpregos()
    DGS:dgsCloseWindow(janelaEmpregos)
    showCursor(false)
end

function escolhaJanelaEmpregos()
    outputChatBox("OLA")
        local selected = DGS:dgsGridListGetSelectedItem(listaEmpregos)
        if selected == 1 then 
            outputChatBox("lol")
        end
    DGS:dgsCloseWindow(janelaEmpregos)
    showCursor(false)
end

Why is the second function not working?

It sends the first ChaBox (OLA)

but then, it doesn't send the second chatbox (lol)

If I change selected == 1 to selected ~= 1 it works with every item, including the first one :/

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