MULTIPAGE issue #1 of not focusable page

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

    • MULTIPAGE issue #1 of not focusable page

      Hello.

      I found the issue of MULTIPAGE-widget.
      If some page does not contain any focusable element (for example only TEXT or disabled all widgets) there is a coloring issue:

      if to return from this page to other page which contains the focusable element(s) then this focusable widget will not have a "focusable" color.

      A simple example demonstrates this issue.
      If you select page 1, then select page 2 and then select page 1 again you will see that no one button is colored as focused.

      This issue is present even in ver. 5.50.

      Question: What API-function or message informs that a page of MULTIPAGE was selected?

      C Source Code

      1. #include "GUI.h"
      2. #include "MULTIPAGE.h"
      3. /*********************************************************************
      4. * Defines
      5. **********************************************************************
      6. */
      7. // Recommended memory to run the sample with adequate performance
      8. //
      9. #define RECOMMENDED_MEMORY (1024L * 20)
      10. /*********************************************************************
      11. * Dialog resource
      12. *
      13. * These tables contain the information required to create the dialogs.
      14. * It has been created manually, but could also be created by the GUIBuilder.
      15. */
      16. static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
      17. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      18. { TEXT_CreateIndirect, "Dialog 1", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
      19. { BUTTON_CreateIndirect, "Button 1", GUI_ID_BUTTON0, 5, 30, 80, 20, 0},
      20. { BUTTON_CreateIndirect, "Button 1", GUI_ID_BUTTON1, 5, 60, 80, 20, 0},
      21. };
      22. static const GUI_WIDGET_CREATE_INFO _aDialogCreate2[] = {
      23. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      24. { TEXT_CreateIndirect, "Dialog 2", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
      25. { TEXT_CreateIndirect, "Text 1", GUI_ID_TEXT0, 25, 30, 50, 15, TEXT_CF_LEFT },
      26. { TEXT_CreateIndirect, "Text 2", GUI_ID_TEXT1, 25, 50, 50, 15, TEXT_CF_LEFT },
      27. };
      28. static const GUI_WIDGET_CREATE_INFO _aDialogCreate3[] = {
      29. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      30. { TEXT_CreateIndirect, "Dialog 3", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
      31. { RADIO_CreateIndirect, "", GUI_ID_RADIO0, 5, 30, 0, 0, 0, 3},
      32. { TEXT_CreateIndirect, "Option 1", GUI_ID_TEXT0, 25, 30, 50, 15, TEXT_CF_LEFT },
      33. { TEXT_CreateIndirect, "Option 2", GUI_ID_TEXT1, 25, 50, 50, 15, TEXT_CF_LEFT },
      34. { TEXT_CreateIndirect, "Option 3", GUI_ID_TEXT2, 25, 70, 50, 15, TEXT_CF_LEFT },
      35. };
      36. /*********************************************************************
      37. * Public code
      38. **********************************************************************
      39. */
      40. /*********************************************************************
      41. * MainTask
      42. */
      43. void MainTask(void) {
      44. WM_HWIN hMultiPage;
      45. WM_HWIN hFrameWin;
      46. WM_HWIN hDialog;
      47. //
      48. // Enable use of memory devices
      49. //
      50. WM_SetCreateFlags(WM_CF_MEMDEV);
      51. GUI_Init();
      52. //
      53. // Check if recommended memory for the sample is available
      54. //
      55. if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
      56. GUI_ErrorOut("Not enough memory available.");
      57. return;
      58. }
      59. //
      60. // Create the frame window
      61. //
      62. hFrameWin = FRAMEWIN_Create("FrameWindow", NULL, WM_CF_SHOW, 40, 44, 240, 152);
      63. FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN);
      64. FRAMEWIN_SetActive(hFrameWin, 1);
      65. FRAMEWIN_SetMoveable(hFrameWin, 1);
      66. //
      67. // Create the MULTIPAGE widget
      68. //
      69. hMultiPage = MULTIPAGE_CreateEx(7, 6, 220, 120, WM_GetClientWindow(hFrameWin), WM_CF_SHOW, 0, 0);
      70. //
      71. // Create and attach the MULTIPAGE dialog windows
      72. //
      73. hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0);
      74. MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 1");
      75. hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0);
      76. MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 2");
      77. hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0);
      78. MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3");
      79. while (1) {
      80. GUI_Delay(100);
      81. }
      82. }
      83. /*************************** End of file ****************************/
      Display All
      Best regards,
      Volodymyr.

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

    • Hi Volodymyr,

      thank you for reporting this issue, we will fix that. About your question, when a new page is selected, a WM_NOTIFICATION_VALUE_CHANGED notification will be sent and the selection will be changed via MULTIPAGE_SelectPage().

      Best regards,

      Florian
      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.

      The post was edited 1 time, last by SEGGER - Florian ().

    • SEGGER - Florian wrote:

      About your question, when a new page is selected, a WM_NOTIFICATION_VALUE_CHANGED will be sent and the selection will be changed via MULTIPAGE_SelectPage().
      Hi Florian.

      Is there a way to get a message about new selected page from assigned callback-function of MULTIPAGE-widget, not from callback of its parent window?

      Or how can I fix this issue with color of focused object, what is the best way?
      Best regards,
      Volodymyr.

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

    • Hi Volodymyr,

      yes, this is doable. WM_NOTIFICATION_VALUE_CHANGED is the value of a WM_NOTIFY_PARENT message. That message gets sent to the parent window, as the name indicates. But you can of course send the message to any other window you'd like to.
      This is how you do it:

      C Source Code

      1. #include "GUI.h"
      2. #include "MULTIPAGE.h"
      3. /*********************************************************************
      4. *
      5. * Static data
      6. *
      7. **********************************************************************
      8. */
      9. static WM_HWIN _hMulti;
      10. static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
      11. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      12. { TEXT_CreateIndirect, "Dialog 1", GUI_ID_TEXT0, 5, 10, 50, 20, TEXT_CF_LEFT },
      13. { BUTTON_CreateIndirect, "Button 1", GUI_ID_BUTTON0, 5, 30, 80, 20, 0 },
      14. { BUTTON_CreateIndirect, "Button 2", GUI_ID_BUTTON1, 5, 60, 80, 20, 0 },
      15. };
      16. static const GUI_WIDGET_CREATE_INFO _aDialogCreate2[] = {
      17. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      18. { TEXT_CreateIndirect, "Dialog 2", GUI_ID_TEXT1, 5, 10, 50, 20, TEXT_CF_LEFT },
      19. { TEXT_CreateIndirect, "Text 1", GUI_ID_TEXT2, 25, 30, 50, 15, TEXT_CF_LEFT },
      20. { TEXT_CreateIndirect, "Text 2", GUI_ID_TEXT3, 25, 50, 50, 15, TEXT_CF_LEFT },
      21. };
      22. static const GUI_WIDGET_CREATE_INFO _aDialogCreate3[] = {
      23. { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 100, FRAMEWIN_CF_MOVEABLE },
      24. { TEXT_CreateIndirect, "Dialog 3", GUI_ID_TEXT4, 5, 10, 50, 20, TEXT_CF_LEFT },
      25. { RADIO_CreateIndirect, "", GUI_ID_RADIO0, 5, 30, 0, 0, 0, 3 },
      26. { TEXT_CreateIndirect, "Option 1", GUI_ID_TEXT5, 25, 30, 50, 15, TEXT_CF_LEFT },
      27. { TEXT_CreateIndirect, "Option 2", GUI_ID_TEXT6, 25, 50, 50, 15, TEXT_CF_LEFT },
      28. { TEXT_CreateIndirect, "Option 3", GUI_ID_TEXT7, 25, 70, 50, 15, TEXT_CF_LEFT },
      29. };
      30. /*********************************************************************
      31. *
      32. * Static code
      33. *
      34. **********************************************************************
      35. */
      36. /*********************************************************************
      37. *
      38. * _cbBk
      39. */
      40. static void _cbBk(WM_MESSAGE * pMsg) {
      41. switch (pMsg->MsgId) {
      42. case WM_NOTIFY_PARENT:
      43. //
      44. // If we got the corrent notification, send it to the MULTIPAGE widget.
      45. //
      46. if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
      47. WM_SendMessage(_hMulti, pMsg);
      48. }
      49. break;
      50. default:
      51. WM_DefaultProc(pMsg);
      52. break;
      53. }
      54. }
      55. /*********************************************************************
      56. *
      57. * _cbMulti
      58. */
      59. static void _cbMulti(WM_MESSAGE * pMsg) {
      60. switch (pMsg->MsgId) {
      61. case WM_NOTIFY_PARENT:
      62. //
      63. // Check if it is the correct notification.
      64. //
      65. if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
      66. //
      67. // Do something...
      68. //
      69. }
      70. break;
      71. default:
      72. MULTIPAGE_Callback(pMsg);
      73. break;
      74. }
      75. }
      76. /*********************************************************************
      77. *
      78. * Public code
      79. *
      80. **********************************************************************
      81. */
      82. /*********************************************************************
      83. *
      84. * MainTask
      85. */
      86. void MainTask(void) {
      87. WM_HWIN hDialog;
      88. //
      89. // Init GUI
      90. //
      91. GUI_Init();
      92. //
      93. // Create a parent window or set callback to background
      94. //
      95. WM_SetCallback(WM_HBKWIN, _cbBk);
      96. //
      97. // Create multipage widget
      98. //
      99. _hMulti = MULTIPAGE_CreateEx(7, 6, 220, 120, WM_HBKWIN, WM_CF_SHOW, 0, 0);
      100. //
      101. // Set custom callback to multipage widget
      102. //
      103. WM_SetCallback(_hMulti, _cbMulti);
      104. //
      105. // Create and attach the MULTIPAGE dialog windows
      106. //
      107. hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0);
      108. MULTIPAGE_AddPage(_hMulti, hDialog, "Page 1");
      109. hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0);
      110. MULTIPAGE_AddPage(_hMulti, hDialog, "Page 2");
      111. hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0);
      112. MULTIPAGE_AddPage(_hMulti, hDialog, "Page 3");
      113. while (1) {
      114. GUI_Delay(100);
      115. }
      116. }
      Display All



      Best regards,

      Florian
      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.
    • SEGGER - Florian wrote:

      yes, this is doable.

      Hi Florian.

      Your way is not usable for me because I create multiple nested MULTIPAGEs (several MULTIPAGEs inside each of tab of top MULTIPAGE, see pictures), so I do not use the WINDOW handle of each nested MULTIPAGE, I am working only with and inside MULTIPAGE's callbacks.

      By the way, this above mentioned issue with MULTIPAGE concerns not only to the color.
      If there is a page with no focusable element and if this page is selected, but the keyboard-activity is applied to another tab, which contains focusable objects.
      Images
      • 00.png

        21.84 kB, 640×480, viewed 488 times
      • 01.png

        21.82 kB, 640×480, viewed 469 times
      • 02.png

        18.11 kB, 640×480, viewed 484 times
      Best regards,
      Volodymyr.