Show Value on SCREEN show > using WM_INIT_DIALOG?

  • - AppWizard V1.52_6.44b

    I am wondering which window message is appropriate to use.
    I would like to show values on Text objects every time a screen is displayed (SCREEHNSHOW job).

    According to the emWin User Guide, I think WM_INIT_DIALOG may be the one to use.
    6.1.6.3.5 WM_INIT_DIALOG
    Is this right?


    I wrote the code like this as SCREEN_01 onShow:

    void cbID_SCREEN_01(WM_MESSAGE * pMsg) {
    GUI_USE_PARA(pMsg);

    switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
    int nop = 1; // for breakpoint
    break;
    }
    }

    By checking with breakpoint, it seems that I can do what I would like to do.

    If I make mistakes, I would like to know other ways.

  • Hello,

    just checked WM_INIT_DIALOG is called every time SHOWSCREEN job working even the screen is in persistent mode. It's a little strange as if you're using just emWin without APPWizard engine WM_INIT_DIALOG logically sent to a dialog only once when the dialog is created until it's been deleted. So you can use an approach you're using. But why not use interactions mechanism since you're into APPWizard? More elegant solution, it seems to me...

    upd: check the message WM_NOTIFY_VIS_CHANGED. I've never tried it but seems that's what's you're looking for. The only clarification: library that you're using must be compiled with a special #define to support this message. I don't know if NXP version done like this.

    Regards,

    Anthony

    Edited once, last by cilmagemlu (January 28, 2025 at 4:23 PM).

  • Dear Anthony

    Thank you very much for your reply. It helps.

    The reason why I do not use interactions mechanism so much is that I am thiking to build up some features based on my user code using API calls.
    This is what we have been for a very long time using other GUIs. Based on this, we can proceed more flexible software development.
    However, I am not thiking not to use all the AppWizard mechanisms. I will use AppWizard for some parts (e.g. screen design, Text resource, Font resource...)
    and may not use for other parts (the parts more flexible using API calls).
    After studying emWin and AppWizard for more time, I will consider how to use and what to use.

    During the study, I am using interactions for a small test.

    I will check WM_NOTIFY_VIS_CHANGED message.
    If I found something, I will reply on this thread.

    Thanks

  • I checked WM_NOTIFY_VIS_CHANGED message.

    void cbID_SCREEN_01(WM_MESSAGE * pMsg) {
    int nop;
    GUI_USE_PARA(pMsg);


    switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
    nop = 1; // for breakpoint
    break;
    case WM_NOTIFY_VIS_CHANGED:
    nop = 1; // for breakpoint
    break;
    }
    }

    When the screen is switched from SCREEN_00 to SCREEN_01,
    WM_INIT_DIALOG is processed
    WM_NOTIFY_VIS_CHANGED is NOT processed.

    6.1.6.3.9 WM_NOTIFY_CHANGED
    WM_NOTIFY_VIS_CHANGED message is not sent in screen switching because the visibility is not changed.

  • Hello,

    it is not entirely clear what job are you using when switching the screens. In your first message it was about SHOWSCREEN job. Logically the screen was hidden before you show it and the visibility is changed. Otherwise everything can be.

    Regards,

    Anthony

  • I am using SHOWSCREEN job to switch the screens.

    I wonder why the WM_NOTIFY_VIS_CHANGED message is not sent.

    6.1.6.3.9 WM_NOTIFY_VIS_CHANGED
    > This message is sent to a window if its visibility is changed and the configuration switch WM_SUPPORT_NOTIFY_VIS_CHANGED is set to 1.

    WM_SUPPORT_NOTIFY_VIS_CHANGED is not set to 1 by default (sec 6.1.7.1). I will look the configuration how to enable it.

    Best regards

    Edited once, last by yasokada (January 29, 2025 at 9:46 AM).

  • I found the definition of WM_SUPPORT_NOTIFY_VIS_CHANGED at GUI_Lib/WM.h

    #ifndef WM_SUPPORT_NOTIFY_VIS_CHANGED
    #define WM_SUPPORT_NOTIFY_VIS_CHANGED 0
    #endif

    I changed into「#define WM_SUPPORT_NOTIFY_VIS_CHANGED 1」.
    However, WM_NOTIFY_VIS_CHANGED message is not sent.

    I also define the WM_SUPPORT_NOTIFY_VIS_CHANGED to 1 outside the ifndef.

    It did not worked either.

  • Yes, I'm using STM32 and just checked WM_NOTIFY_VIS_CHANGED is not working cause it is precompiled library with WM_SUPPORT_NOTIFY_VIS_CHANGED set to 0.

    If you're using emWin sources you can just rebuild it with WM_SUPPORT_NOTIFY_VIS_CHANGED set to 1.

    If you're using binary precompiled library and you see this defined as 0 you can't change things. Then just use WM_INIT_DIALOG.

    Regards,

    Anthony

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!