Hello.
I found the issue with the function WM_SetUntouchable.
Conditions:
1. There is a window bottomWin, it contains the button, that creates new window newWin, which fully overlaps bottomWin.
2. newWin contains a button that creates two new small derWin_1 and derWin_2.
After creating of them the newWin should be untouchable until windows derWin_1 and derWin_2 will be closed.
The windows derWin_1 and derWin_2 both should can receive PID-events:
- one of them is the window (derWin_1) with some editable widgets like EDIT, SPINBOX etc., that should receive keys from virtual keyboard,
- second is the virtual keyboard (derWin_2).
I used the function WM_SetUntouchable for making the newWin untouchable.
Issue:
If I touch on the area of the untouchable newWin then this touch reaches the touchable bottomWin, it appears on top over all windows with focus on it.
Question:
Is this behaviour correct considering the newWin fully overlaps the bottomWin?
Display All
I found the issue with the function WM_SetUntouchable.
Conditions:
1. There is a window bottomWin, it contains the button, that creates new window newWin, which fully overlaps bottomWin.
2. newWin contains a button that creates two new small derWin_1 and derWin_2.
After creating of them the newWin should be untouchable until windows derWin_1 and derWin_2 will be closed.
The windows derWin_1 and derWin_2 both should can receive PID-events:
- one of them is the window (derWin_1) with some editable widgets like EDIT, SPINBOX etc., that should receive keys from virtual keyboard,
- second is the virtual keyboard (derWin_2).
I used the function WM_SetUntouchable for making the newWin untouchable.
Issue:
If I touch on the area of the untouchable newWin then this touch reaches the touchable bottomWin, it appears on top over all windows with focus on it.
Question:
Is this behaviour correct considering the newWin fully overlaps the bottomWin?
C Source Code
- #include "DIALOG.h"
- static WM_HWIN bottomWin;
- static WM_HWIN newWin;
- static WM_HWIN derWin_1;
- static WM_HWIN derWin_2;
- static const GUI_WIDGET_CREATE_INFO _aBottom[] = {
- { FRAMEWIN_CreateIndirect, "Main window", 0, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
- { BUTTON_CreateIndirect, "New window", GUI_ID_BUTTON0, 50, 50, 80, 20, 0, 0x0, 0 },
- };
- static const GUI_WIDGET_CREATE_INFO _aNew[] = {
- { FRAMEWIN_CreateIndirect, "New window", 0, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
- { BUTTON_CreateIndirect, "Two windows", GUI_ID_BUTTON0, 40, 40, 80, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Close", GUI_ID_BUTTON1, 40, 80, 80, 20, 0, 0x0, 0 },
- };
- static const GUI_WIDGET_CREATE_INFO _aDer_1[] = {
- { FRAMEWIN_CreateIndirect, "Derived window 1", NULL, 100, 10, 150, 90, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
- { MULTIEDIT_CreateIndirect, NULL, GUI_ID_EDIT0, 10, 10, 80, 50, 0, 0x128, 128 },
- };
- static const GUI_WIDGET_CREATE_INFO _aDer_2[] = {
- { FRAMEWIN_CreateIndirect, "Small kbd", NULL, 100, 120, 150, 90, FRAMEWIN_CF_MOVEABLE, 0x0, 0 },
- { BUTTON_CreateIndirect, "0", GUI_ID_BUTTON0, 10, 10, 20, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "1", GUI_ID_BUTTON1, 40, 10, 20, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "2", GUI_ID_BUTTON2, 70, 10, 20, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "3", GUI_ID_BUTTON3, 100, 10, 20, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Close", GUI_ID_BUTTON9, 10, 40, 80, 20, 0, 0x0, 0 },
- };
- static void _cbDer_2(WM_MESSAGE * pMsg) {
- int NCode;
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0), 0);
- BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON1), 0);
- BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON2), 0);
- BUTTON_SetFocusable(WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON3), 0);
- break;
- case WM_NOTIFY_PARENT:
- switch (pMsg->Data.v) {
- case WM_NOTIFICATION_RELEASED:
- switch (WM_GetId(pMsg->hWinSrc)) {
- case GUI_ID_BUTTON0 ... GUI_ID_BUTTON8:
- NCode = 0;
- BUTTON_GetText(pMsg->hWinSrc, &NCode, 2);
- GUI_SendKeyMsg(NCode, 1);
- break;
- case GUI_ID_BUTTON9:
- WM_SetUntouchable(newWin, 0);
- GUI_EndDialog(pMsg->hWin, 0);
- GUI_EndDialog(derWin_1, 0);
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- static void _cbNew(WM_MESSAGE * pMsg) {
- switch (pMsg->MsgId) {
- case WM_NOTIFY_PARENT:
- switch (pMsg->Data.v) {
- case WM_NOTIFICATION_RELEASED:
- switch (WM_GetId(pMsg->hWinSrc)) {
- case GUI_ID_BUTTON0:
- WM_SetUntouchable(pMsg->hWin, 1);
- derWin_2 = GUI_CreateDialogBox(_aDer_2, GUI_COUNTOF(_aDer_2), _cbDer_2, WM_HBKWIN, 0, 0);
- FRAMEWIN_SetClientColor(derWin_2, GUI_YELLOW);
- WM_DisableWindow(derWin_2);
- derWin_1 = GUI_CreateDialogBox(_aDer_1, GUI_COUNTOF(_aDer_1), NULL, WM_HBKWIN, 0, 0);
- break;
- case GUI_ID_BUTTON1:
- GUI_EndDialog(pMsg->hWin, 0);
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- static void _cbBottom(WM_MESSAGE * pMsg) {
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- FRAMEWIN_SetClientColor(pMsg->hWin, GUI_GRAY);
- break;
- case WM_NOTIFY_PARENT:
- switch (pMsg->Data.v) {
- case WM_NOTIFICATION_RELEASED:
- switch (WM_GetId(pMsg->hWinSrc)) {
- case GUI_ID_BUTTON0:
- newWin = GUI_CreateDialogBox(_aNew, GUI_COUNTOF(_aNew), _cbNew, WM_HBKWIN, 0, 0);
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void MainTask(void) {
- GUI_Init();
- WM_SetBkWindowColor(GUI_WHITE);
- bottomWin = GUI_CreateDialogBox(_aBottom, GUI_COUNTOF(_aBottom), _cbBottom, WM_HBKWIN, 0, 0);
- while (1) {
- GUI_Delay(100);
- };
- }
Best regards,
Volodymyr.
Volodymyr.