Hello again.
There is a next issue with a non-focusable page (page, that does not contain focusable widgets) of MULTIPAGE.
It concerns using the keyboard.
A simple example demonstrates this issue.
Using the keyboard (keys "PgUp", "PgDown"):
1. Go to the Page 1 (using key "PgUp").
2. Open the Dropdown list using key "Space".
3. Press key "PgDown" to select next page. Press it again.
As you see, there is no keyboard reaction because the MULTIPAGE has lost focus...
Question: How to avoid this issue using currently available emWin? How to fix it properly?
Display All
There is a next issue with a non-focusable page (page, that does not contain focusable widgets) of MULTIPAGE.
It concerns using the keyboard.
A simple example demonstrates this issue.
Using the keyboard (keys "PgUp", "PgDown"):
1. Go to the Page 1 (using key "PgUp").
2. Open the Dropdown list using key "Space".
3. Press key "PgDown" to select next page. Press it again.
As you see, there is no keyboard reaction because the MULTIPAGE has lost focus...
Question: How to avoid this issue using currently available emWin? How to fix it properly?
C Source Code
- #include "GUI.h"
- #include "MULTIPAGE.h"
- #define RECOMMENDED_MEMORY (1024L * 20)
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
- { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 180, FRAMEWIN_CF_MOVEABLE },
- { TEXT_CreateIndirect, "Dialog 1", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
- { DROPDOWN_CreateIndirect, NULL, GUI_ID_DROPDOWN1, 5, 30, 80, 50, 0},
- { BUTTON_CreateIndirect, "Button 1", GUI_ID_BUTTON0, 5, 60, 80, 20, 0},
- };
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate2[] = {
- { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 180, FRAMEWIN_CF_MOVEABLE },
- { TEXT_CreateIndirect, "Dialog 2", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Text 1", GUI_ID_TEXT0, 25, 30, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Text 2", GUI_ID_TEXT1, 25, 50, 50, 15, TEXT_CF_LEFT },
- };
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate3[] = {
- { WINDOW_CreateIndirect, NULL, 0, 0, 0, 260, 180, FRAMEWIN_CF_MOVEABLE },
- { TEXT_CreateIndirect, "Dialog 3", 0, 5, 10, 50, 20, TEXT_CF_LEFT },
- { RADIO_CreateIndirect, NULL, GUI_ID_RADIO0, 5, 30, 0, 0, 0, 3},
- { TEXT_CreateIndirect, "Option 1", GUI_ID_TEXT0, 25, 30, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Option 2", GUI_ID_TEXT1, 25, 50, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Option 3", GUI_ID_TEXT2, 25, 70, 50, 15, TEXT_CF_LEFT },
- };
- void MainTask(void) {
- WM_SetCreateFlags(WM_CF_MEMDEV);
- GUI_Init();
- if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
- GUI_ErrorOut("Not enough memory available.");
- return;
- }
- WM_HWIN hFrameWin = FRAMEWIN_Create("FrameWindow", NULL, WM_CF_SHOW, 10, 20, 300, 200);
- WM_HWIN hClientWin = WM_GetClientWindow(hFrameWin);
- FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN);
- FRAMEWIN_SetMoveable(hFrameWin, 1);
- WM_HWIN hMultiPage = MULTIPAGE_CreateEx(5, 5, WM_GetWinSizeX(hClientWin) - 10, WM_GetWinSizeY(hClientWin) - 10, hClientWin, WM_CF_SHOW, 0, 0);
- WM_HWIN hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0);
- WM_HWIN hDropdown = WM_GetDialogItem(hDialog, GUI_ID_DROPDOWN1);
- DROPDOWN_AddString(hDropdown, "Item 1");
- DROPDOWN_AddString(hDropdown, "Item 2");
- DROPDOWN_AddString(hDropdown, "Item 3");
- MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 1");
- hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0);
- MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 2");
- hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0);
- MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3");
- while (1) {
- GUI_Delay(100);
- }
- }
Best regards,
Volodymyr.
Volodymyr.