Enter key to the widget always passed to the parent dialog...

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

  • Enter key to the widget always passed to the parent dialog...

    Hi,

    I am testing a small example program that has a dialog, within which a message box with an OK button is shown by the callback function of the dialog. I noticed that after pressing the Enter key to dismiss the message box, the Enter key is always passed to the parent (the dialog).
    So, my understanding is that, if a dialog has a widget with the focus (like a message box as above mentioned), the key press to the widget is supposed to be consumed by the widget and NOT being passed to the parent. But why the Enter key is still passed to the parent (the dialog box) even though it should be used (consumed) by the message box's OK button?
    Maybe I did it wrong. If so, what is the right way to implement it?
    Thanks.
  • RE: Enter key to the widget always passed to the parent dialog...

    achieveforce wrote:

    Hi,

    I am testing a small example program that has a dialog, within which a message box with an OK button is shown by the callback function of the dialog. I noticed that after pressing the Enter key to dismiss the message box, the Enter key is always passed to the parent (the dialog).
    So, my understanding is that, if a dialog has a widget with the focus (like a message box as above mentioned), the key press to the widget is supposed to be consumed by the widget and NOT being passed to the parent. But why the Enter key is still passed to the parent (the dialog box) even though it should be used (consumed) by the message box's OK button?
    Maybe I did it wrong. If so, what is the right way to implement it?
    Thanks.
    Push, Who Can Help??

    I have same trouble. Enter key can not close message_box...
  • Hello,

    Forwarding key messages to the parent window is the intended way for dialogs to function. For detailed information on how to implement this, please refer to the section 19.2.2.2 "Defining dialog behavior" in the emWin user manual.

    Best regards,
    Adrian
  • SEGGER - Adrian wrote:

    Defining dialog behavior
    Sorry, Can not understand you. The example in user manual execute same function for button message(in WM_NOTIFY_PARENT) and dialog message.

    When "Enter" key is pushed, the message should be sent to button. However, the message was sent to dialog.
    So, the action was the function inside case WM_KEY, but not inside WM_NOTIFY_PARENT.
  • Hello,

    Yes, there is a message sent to the BUTTON. Of course you can overwrite the callback function of the BUTTON in order to react to that message. Still it is the intended way to react to the notification messages which are sent to the parent.

    Best regards,
    Adrian