How to make dialog response the key?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to make dialog response the key?


    I use the GUIBuilder to create a dialog with a window, a text and a image widgets, I need the dialog can response the ENTER key. What I try is,

    modify the dialog callback, added this

    C Source Code

    1. case WM_KEY:
    2. Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key;
    3. switch (Key)
    4. {
    5. case GUI_KEY_ENTER:
    6. break;
    7. default:
    8. WM_DefaultProc(pMsg);
    9. }
    10. break;

    But it doesn't work, so How do I implement this requirement?


    The post was edited 1 time, last by mkitby ().

  • Hello,

    The Window Manager handles keyboard input automatically. It polls the keyboard
    buffer and sends according keyboard messages to the currently focussed window.(UM03001_emWin5.pdf 18.2.11)

    The WINDOW widget (UM03001_emWin5.pdf 19.29.2) , TEXT widget (UM03001_emWin5.pdf 19.27.4) and
    the IMAGE widget can not gain the input focus and does not react on keyboard input.

    If you MUST do react on keyboard input, you can try:

    hWin = GUI_CreateDialogBox(.....);
    WM__ahWinFocus[0] = hWin;