TAB - ENTER

HMG en Español

Moderator: Rathinagiri

Post Reply
Mario Mansilla
Posts: 244
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina
Been thanked: 2 times

TAB - ENTER

Post by Mario Mansilla » Wed May 23, 2018 2:23 pm

Hola Amigos :
necesito saber como puedo hacer para que al presionar la tecla TAB estando en un control TEXTBOX se ejecute el evento ONENTER como si presionara ENTER .
Esto debido a que muchos clientes estan acostumbrados a usar el TAB y al realizarlo no se ejecuta el procedimiento ligado al evento ONENTER . Probe colocando el contenido del evento ONENTER en el ONLOSTFOCUS pero genera problemas .
Saludos cordiales
Mario Mansilla

Hello friends :
I need to know how I can do so by pressing the TAB key while in a TEXTBOX control the ONENTER event is executed as if you were pressing ENTER.
This is due to the fact that many clients are used to using the TAB and when executing it, the procedure linked to the ONENTER event is not executed. Probe placing the content of the ONENTER event in the ONLOSTFOCUS but generates problems.
Best regards
Mario Mansilla

User avatar
andyglezl
Posts: 983
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 20 times
Been thanked: 41 times
Contact:

Post by andyglezl » Wed May 23, 2018 4:09 pm

Esto debido a que muchos clientes estan acostumbrados a usar el TAB y al realizarlo no se ejecuta el procedimiento ligado al evento ONENTER
Creo que esa es precisamente la funcion da la tecla TAB, avanzar entre campos sin validar...

Quizá pudieras utilizar NOTABSTOP del segundo al último campo, así, siempre que opriman TAB,
se regresará al primer campo y tendrán que utilizar ENTER.
----------------------------------------------------------------------------------------------------------------------
I think that is precisely the function given by the TAB key, to advance between unvalidated fields ...

Maybe you could use NOTABSTOP from the second to the last field, so, as long as you press TAB,
it will be returned to the first field and they will have to use ENTER.
Andrés González López
Desde Guadalajara, Jalisco. México.

edk
Posts: 343
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 96 times
Been thanked: 252 times

Post by edk » Wed May 23, 2018 6:05 pm

Maybe something like that: :?:

Code: Select all

#include <hmg.ch>

Function Main

DEFINE WINDOW test AT 139 , 235 WIDTH 383 HEIGHT 419 TITLE "Test" MAIN

    DEFINE TEXTBOX Text_1
        ROW    50
        COL    190
        WIDTH  120
        HEIGHT 24
        ONCHANGE Nil
        ONGOTFOCUS OnTab()
        ONLOSTFOCUS ReleaseTab()
        ONENTER test.Text_6.Value:="On Enter Action"
        VALUE "hello!"
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    90
        COL    190
        WIDTH  120
        HEIGHT 24
        NUMERIC .T. 
        VALUE 100
    END TEXTBOX

    DEFINE TEXTBOX Text_3
        ROW    130
        COL    190
        WIDTH  120
        HEIGHT 24
        DATE .T. 
        VALUE Date()
    END TEXTBOX

    DEFINE LABEL Label_1
        ROW    50
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_1"
    END LABEL

    DEFINE LABEL Label_2
        ROW    90
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_2"
    END LABEL

    DEFINE LABEL Label_3
        ROW    130
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_3"
    END LABEL

    DEFINE FRAME Frame_1
        ROW    10
        COL    30
        WIDTH  310
        HEIGHT 170
        CAPTION "Frame_1"
    END FRAME

    DEFINE FRAME Frame_2
        ROW    190
        COL    30
        WIDTH  310
        HEIGHT 170
        CAPTION "Frame_2"
    END FRAME

    DEFINE TEXTBOX Text_4
        ROW    230
        COL    190
        WIDTH  120
        HEIGHT 24
        VALUE ""
    END TEXTBOX

    DEFINE TEXTBOX Text_5
        ROW    270
        COL    190
        WIDTH  120
        HEIGHT 24
        NUMERIC .T. 
        VALUE Nil
    END TEXTBOX

    DEFINE TEXTBOX Text_6
        ROW    310
        COL    190
        WIDTH  120
        HEIGHT 24
        VALUE ""
    END TEXTBOX

    DEFINE LABEL Label_4
        ROW    230
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_4"
    END LABEL

    DEFINE LABEL Label_5
        ROW    270
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_5"
    END LABEL

    DEFINE LABEL Label_6
        ROW    310
        COL    60
        WIDTH  120
        HEIGHT 24
        VALUE "Label_6"
    END LABEL

END WINDOW

activate window test

Return

FUNCTION OnTab()
ON KEY TAB OF test ACTION (ReleaseTab(), _PushKey (VK_RETURN), _PushKey (VK_TAB))
RETURN

FUNCTION ReleaseTab()
RELEASE KEY TAB OF test
RETURN


Mario Mansilla
Posts: 244
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina
Been thanked: 2 times

Post by Mario Mansilla » Wed May 30, 2018 1:17 pm

Hola amigos :
muchas gracias por su ayuda .
Saludos
Mario Mansilla

Hello friends :
thank you very much for your help .
regards
Mario Mansilla

Post Reply