show child windows and hide the parent window

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

  • show child windows and hide the parent window

    Hello,

    I have created a window as parent which has multiple child windows. My intention is to hide the parent window and show one of it's child window at once. But
    when I hide the parent the entire child windows are hidden, even if I try to show one of the child window. How can I solve this problem? Or does anybody know how can I supress the pointer Input device of a window in general? I mean it shouldn't receive any Input devices after creation anymore.

    Thanks for your help. :)
  • Hi Manfred,

    You can try to detach the child window from its parent by using WM_DetachWindow(). To attach it again use WM_AttachWindow().

    EDIT:
    To suppress touch inout you can try to overwrite the callback of a window, react on WM_TOUCH and simply do nothing. Or use WM_SetCapture() and make sure just one specific window receivs touch inout.

    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hey Schoenen,

    thanks for your report. To overwrite the callback could be a good idea. But what exactly happens when I detach a child window? How is the new parent? I red that detached Windows will not be redrawn. So I guess when I detach a child window from it's hidden parent for Intention to show it will not be redrawn and as a result it will not be visible. Is it right?

    Regards Manfred
  • Hello Manfred,

    A detached window gets deleted from a list of present windows and therefore won't get redrawn.

    But you hide the parent, detach the child and attach it immediately to another window (e.g. WM_HBKWIN). This will hide the parent and the child stays visible.

    Like this:

    C Source Code

    1. #include "DIALOG.h"
    2. /*********************************************************************
    3. *
    4. * Defines
    5. *
    6. **********************************************************************
    7. */
    8. #define COLOR_BLUE GUI_MAKE_COLOR(0x00623700)
    9. #define COLOR_LIGHTGRAY GUI_MAKE_COLOR(0x00F2F2F2)
    10. #define COLOR_LEMON GUI_MAKE_COLOR(0x0014B6A9)
    11. /*********************************************************************
    12. *
    13. * Typedefs
    14. *
    15. **********************************************************************
    16. */
    17. /*********************************************************************
    18. *
    19. * Static data
    20. *
    21. **********************************************************************
    22. */
    23. /*********************************************************************
    24. *
    25. * Static code
    26. *
    27. **********************************************************************
    28. */
    29. /*********************************************************************
    30. *
    31. * _cbWin0
    32. */
    33. static void _cbWin0(WM_MESSAGE * pMsg) {
    34. switch (pMsg->MsgId) {
    35. case WM_PAINT:
    36. GUI_SetBkColor(COLOR_LIGHTGRAY);
    37. GUI_Clear();
    38. break;
    39. default:
    40. WM_DefaultProc(pMsg);
    41. break;
    42. }
    43. }
    44. /*********************************************************************
    45. *
    46. * _cbWin01
    47. */
    48. static void _cbWin1(WM_MESSAGE * pMsg) {
    49. switch (pMsg->MsgId) {
    50. case WM_PAINT:
    51. GUI_SetBkColor(COLOR_LEMON);
    52. GUI_Clear();
    53. break;
    54. default:
    55. WM_DefaultProc(pMsg);
    56. break;
    57. }
    58. }
    59. /*********************************************************************
    60. *
    61. * Public code
    62. *
    63. **********************************************************************
    64. */
    65. /*********************************************************************
    66. *
    67. * MainTask
    68. */
    69. void MainTask(void) {
    70. WM_HWIN hWin0, hWin1;
    71. int xSize;
    72. int ySize;
    73. GUI_Init();
    74. WM_SetDesktopColor(COLOR_BLUE);
    75. WM_MULTIBUF_Enable(1);
    76. xSize = LCD_GetXSize();
    77. ySize = LCD_GetYSize();
    78. hWin0 = WM_CreateWindowAsChild(10, 10, 140, 80, WM_HBKWIN, WM_CF_SHOW, _cbWin1, 0);
    79. hWin1 = WM_CreateWindowAsChild(10, 10, 120, 60, hWin0, WM_CF_SHOW, _cbWin0, 0);
    80. GUI_Delay(1500);
    81. WM_HideWindow(hWin0);
    82. WM_DetachWindow(hWin1);
    83. WM_AttachWindowAt(hWin1, WM_HBKWIN, 20, 20);
    84. while (1) {
    85. GUI_Delay(50);
    86. }
    87. }
    88. /*************************** End of file ****************************/
    Display All


    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.