Hello,
I would like to create something similar to what I've depicted below, a dialog made of 4 full-screen "pages" (each page has its own widgets) that the user can navigate through a swipe gesture.
I usually create a Window dialog with its child objects with the GUI_WIDGET_CREATE_INFO approach for the individual pages but I'm not sure if this is the correct approach.
So far I've taken the Move Windows sample as a reference:
wiki.segger.com/WM_MOTION_-_Move_windows_(Sample)
I've created a DialogBox and, in the WM_INIT_DIALOG case of the dialog, I've created a Child window and some buttons:
Display All
I've used the same code of the example for the Child window adding the WM_NOTIFY_PARENT to get the buttons notifications and it looks fine to me.
So, at the moment, the WM_MOTION looks like:
Display All
The two things I would like to achieve are:
- I want the swipe movement to end at the start of the next page, no "in between" situations. So when I swipe from page#1 to page#2 I will see a full screen page#2.
- I want to be able to start the visualization (entering from other windows of the GUI) from a different page than #1 (let's say Page #3 or Page#4) in some cases.
Could anybody supply a guideline code to achieve the described behavior?
Thank you in advance!
Mark
I would like to create something similar to what I've depicted below, a dialog made of 4 full-screen "pages" (each page has its own widgets) that the user can navigate through a swipe gesture.
I usually create a Window dialog with its child objects with the GUI_WIDGET_CREATE_INFO approach for the individual pages but I'm not sure if this is the correct approach.
So far I've taken the Move Windows sample as a reference:
wiki.segger.com/WM_MOTION_-_Move_windows_(Sample)
I've created a DialogBox and, in the WM_INIT_DIALOG case of the dialog, I've created a Child window and some buttons:
Source Code
- //Dialog creation
- hWinMultiPage = GUI_CreateDialogBox(_aGUIMULTIPAGE_MainWinDialogCreate, GUI_COUNTOF(_aGUIMULTIPAGE_MainWinDialogCreate), _cbDialogGUIMULTIPAGE_MainWin, WM_GetDesktopWindowEx(0), 0, 0);
- ...
- //Dialog callback
- static void _cbDialogGUIMULTIPAGE_MainWin(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- WM_HWIN hChildWin;
- // USER START (Optionally insert additional variables)
- int NCode;
- int Id;
- uint16_t ix;
- int xSize;
- int ySize;
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Window'
- //
- hItem = pMsg->hWin;
- //Create window as child
- hChildWin = WM_CreateWindowAsChild(0, 0, (GUI_XSIZE_PHYS*4), GUI_YSIZE_PHYS, hItem, WM_CF_SHOW | WM_CF_MOTION_X, _cbChildWin, 0);
- //Add some buttons
- BUTTON_CreateEx(20, 20, 100, 100, hChildWin, WM_CF_SHOW, 0, GUIMULTIPAGE_ID_TEST_01_BTN);
- BUTTON_CreateEx(20 + 240*1, 20, 100, 100, hChildWin, WM_CF_SHOW, 0, GUIMULTIPAGE_ID_TEST_02_BTN);
- BUTTON_CreateEx(20 + 240*2, 20, 100, 100, hChildWin, WM_CF_SHOW, 0, GUIMULTIPAGE_ID_TEST_03_BTN);
- BUTTON_CreateEx(20 + 240*3, 20, 100, 100, hChildWin, WM_CF_SHOW, 0, GUIMULTIPAGE_ID_TEST_04_BTN);
So, at the moment, the WM_MOTION looks like:
Source Code
- //Inside _cbChildWin callback
- case WM_MOTION:
- pInfo = (WM_MOTION_INFO *)pMsg->Data.p;
- switch (pInfo->Cmd) {
- case WM_MOTION_INIT:
- WM_GetClientRectEx(pMsg->hWin, &Rect);
- //
- // Snap window at each quarter of the entire window
- // Therefore we get several 'pages', each as big as the screen
- //
- pInfo->SnapX = (Rect.x1 + 1) / 4;
- break;
- }
- break;
The two things I would like to achieve are:
- I want the swipe movement to end at the start of the next page, no "in between" situations. So when I swipe from page#1 to page#2 I will see a full screen page#2.
- I want to be able to start the visualization (entering from other windows of the GUI) from a different page than #1 (let's say Page #3 or Page#4) in some cases.
Could anybody supply a guideline code to achieve the described behavior?
Thank you in advance!
Mark
The post was edited 1 time, last by Mark_C ().