Jump to content

Problema con elementos GUI


~ProtoN!

Recommended Posts

Hola a todos!

Tengo un problema con unos elementos GUI. :|

Lo que pasa es que puse dos botones dentro de un Tabpanel y al clickear en cualquier parte del Tabpanel me dispara las funciones que deberian ejecutar los botones! :?:

Acá dejo el codigo a ver si ven algo(Yo no encuentro nada :? )

function elementosGUI() 
    showCursor(true) 
    --Ventana 
        GUI.ventana[1] = guiCreateWindow(20, 200, 264, 283, "Controlador de datos", false) 
        guiWindowSetSizable(GUI.ventana[1], false) 
        --Tab panel 
            GUI.tabpanel[1] = guiCreateTabPanel(9, 26, 245, 247, false, GUI.ventana[1]) 
            --Tab guardar 
                GUI.tab[1] = guiCreateTab("Guardar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[1] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[1], "default-bold-small") 
                    GUI.label[2] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[2], "default-bold-small") 
                    GUI.label[3] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[3], "default-bold-small") 
                --Edits 
                    GUI.edit[1] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[2] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[3] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[1]) 
                --Botones 
                    GUI.boton[1] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[1]) 
                    GUI.boton[2] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[1]) 
            --Tab cargar 
                GUI.tab[2] = guiCreateTab("Cargar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[4] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[4], "default-bold-small") 
                    GUI.label[5] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[5], "default-bold-small") 
                    GUI.label[6] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[6], "default-bold-small") 
                --Edits 
                    GUI.edit[4] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[5] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[6] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[2]) 
                    guiEditSetReadOnly(GUI.edit[6], true)  
                --Botones 
                    GUI.boton[3] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[2]) 
                    GUI.boton[4] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[2]) 
    --Eventos 
        addEventHandler('onClientGUIClick', GUI.boton[1], guardar) 
        addEventHandler('onClientGUIClick', GUI.boton[2], borrarGuardar) 
        addEventHandler('onClientGUIClick', GUI.boton[3], cargar) 
        addEventHandler('onClientGUIClick', GUI.boton[4], borrarCargar) 
end 

Link to comment
function elementosGUI() 
    showCursor(true) 
    --Ventana 
        GUI.ventana[1] = guiCreateWindow(20, 200, 264, 283, "Controlador de datos", false) 
        guiWindowSetSizable(GUI.ventana[1], false) 
        --Tab panel 
            GUI.tabpanel[1] = guiCreateTabPanel(9, 26, 245, 247, false, GUI.ventana[1]) 
            --Tab guardar 
                GUI.tab[1] = guiCreateTab("Guardar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[1] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[1], "default-bold-small") 
                    GUI.label[2] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[2], "default-bold-small") 
                    GUI.label[3] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[3], "default-bold-small") 
                --Edits 
                    GUI.edit[1] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[2] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[3] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[1]) 
                --Botones 
                    GUI.boton[1] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[1]) 
                    GUI.boton[2] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[1]) 
            --Tab cargar 
                GUI.tab[2] = guiCreateTab("Cargar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[4] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[4], "default-bold-small") 
                    GUI.label[5] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[5], "default-bold-small") 
                    GUI.label[6] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[6], "default-bold-small") 
                --Edits 
                    GUI.edit[4] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[5] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[6] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[2]) 
                    guiEditSetReadOnly(GUI.edit[6], true) 
                --Botones 
                    GUI.boton[3] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[2]) 
                    GUI.boton[4] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[2]) 
    --Eventos 
        addEventHandler('onClientGUIClick', GUI.boton[1], guardar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[2], borrarGuardar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[3], cargar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[4], borrarCargar, false ) 
end 

Link to comment
debugscript 3

De nada serviría poner el debugscript porque para funcionar(El script que estoy creando) no tiene ningún problema, la cosa es que cuando clickeo en cualquier parte del tabpanel dispara las funciones que le asigné a los botones y no entiendo por qué pasa eso :(

No te entiendo pusiste botones abajo del tab? para que pusiste botones abajo del tab?

Los botones están dentro del tab, no sé que decís :o

function elementosGUI() 
    showCursor(true) 
    --Ventana 
        GUI.ventana[1] = guiCreateWindow(20, 200, 264, 283, "Controlador de datos", false) 
        guiWindowSetSizable(GUI.ventana[1], false) 
        --Tab panel 
            GUI.tabpanel[1] = guiCreateTabPanel(9, 26, 245, 247, false, GUI.ventana[1]) 
            --Tab guardar 
                GUI.tab[1] = guiCreateTab("Guardar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[1] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[1], "default-bold-small") 
                    GUI.label[2] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[2], "default-bold-small") 
                    GUI.label[3] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[1]) 
                    guiSetFont(GUI.label[3], "default-bold-small") 
                --Edits 
                    GUI.edit[1] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[2] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[1]) 
                    GUI.edit[3] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[1]) 
                --Botones 
                    GUI.boton[1] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[1]) 
                    GUI.boton[2] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[1]) 
            --Tab cargar 
                GUI.tab[2] = guiCreateTab("Cargar", GUI.tabpanel[1]) 
                --Labels 
                    GUI.label[4] = guiCreateLabel(19, 19, 58, 17, "Jugador: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[4], "default-bold-small") 
                    GUI.label[5] = guiCreateLabel(19, 70, 58, 17, "Dato: ", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[5], "default-bold-small") 
                    GUI.label[6] = guiCreateLabel(18, 123, 58, 17, "Valor:", false, GUI.tab[2]) 
                    guiSetFont(GUI.label[6], "default-bold-small") 
                --Edits 
                    GUI.edit[4] = guiCreateEdit(19, 36, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[5] = guiCreateEdit(19, 87, 203, 30, "", false, GUI.tab[2]) 
                    GUI.edit[6] = guiCreateEdit(18, 140, 203, 30, "", false, GUI.tab[2]) 
                    guiEditSetReadOnly(GUI.edit[6], true) 
                --Botones 
                    GUI.boton[3] = guiCreateButton(76, 182, 67, 27, "Aceptar", false, GUI.tab[2]) 
                    GUI.boton[4] = guiCreateButton(154, 182, 67, 27, "Borrar", false, GUI.tab[2]) 
    --Eventos 
        addEventHandler('onClientGUIClick', GUI.boton[1], guardar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[2], borrarGuardar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[3], cargar, false ) 
        addEventHandler('onClientGUIClick', GUI.boton[4], borrarCargar, false ) 
end 

:?::?::?::?:

Link to comment

:?::?::?::?:

significa que pruebes con lo que puse

Muchas gracias me sirvió!

Aunque hubiese sido mejor que me explicaras el error :)

Igual ya me di cuenta, les faltaban el false a los eventos 'onClientGUIClick'. En la wiki no te dicen nada de eso, que funcion cumplen el true y el false en el evento?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...