Passing messages between dialogs?

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

  • Passing messages between dialogs?

    Hi,
    I am using FRAMEWIN widgets encapsulated in Dialogs to
    create a menu driven GUI.

    I’ve figured out how to make one Dialog box create another
    than close itself thus linking them together. But I’d also like to send a message from one Dialog box to th other.

    I’m not sure the code segment below works. It seems that the
    final statement doesn’t always get executed before the new dialog box comes up.


    // This is a four byte variable. msg_bffr_ptr points to it
    msg_bffr = 2;

    // End this dialog
    GUI_EndDialog(pMsg->hWin, 0); // End the current dialog box

    // Create the new dialog box and get its handle
    hCurrentMenu = GUI_CreateDialogBox(_aL2_Configure, GUI_COUNTOF(_aL2_Configure), _cbL2_Configure, WM_HBKWIN, 0, 0);

    // Now set user data in the new dialog box to send the message
    WM_SetUserData(hCurrentMenu, msg_bffr_ptr, 4);
    Can anyone offer suggestions as to how I may achieve the
    intended result?
  • Hello,

    I would recommend using the function WM_SetUserData() only on windows which consist of user data. Windows can only consist of user data, if this was configured at creation. A dialog box is not able to store user data, but the contained widgets are.

    Nevertheless I would recommend using the function WM_SendMessage(). The passed structure WM_MESSAGE contains a union of an int value and a void pointer, so you are free to pass any size of data.

    Best regards,
    Adrian
  • Thank you for your response.
    I can see how WM_MESSAGE may be used to send messages between Windows but it may not work in the case.
    In the code segment below I've created a user message ID called MY_MESSAGE_AAA. It seems though that when the code is executed it never reaches the last statement (I've set a breakpoint on it). I'm wondering if the statement that opens the new window causes the statement below it to never get executed
    GUI_EndDialog(pMsg->hWin, 0);
    hCurrentMenu = GUI_CreateDialogBox(_aL2_Configure, GUI_COUNTOF(_aL2_Configure), _cbL2_Configure, WM_HBKWIN, 0, 0);
    WM_SendMessageNoPara(hCurrentMenu,MY_MESSAGE_AAA);
  • Hello,

    Please note that the function GUI_CreateDialog() returns the handle to the created FRAMEWIN widget. The function which is set as parameter (_cbL2_Configure) is used as callback for the client window. So you should do well using the following code:

    C Source Code

    1. hDialog = GUI_CreateDialogBox(_aL2_Configure, GUI_COUNTOF(_aL2_Configure), _cbL2_Configure, WM_HBKWIN, 0, 0);
    2. hClient = WM_GetClientWindow(hDialog);
    3. WM_SendMessageNoPara(hClient, MY_MESSAGE_AAA);

    Best regards,
    Adrian