Hello to everyone,
my problem is following: here is a simple code with 3 simple windows with content inside the windows that can be moved using motion support.
1st window - content can be moved circularly.
2nd window - content can be moved horizontally.
3rd window - content can be moved vertically.
If I move content in 2nd and 3rd window all is fine and moves as it should.
But if I move content in 1st window with circular motion support and after that I try to move content in other windows then begins the following:
2nd window - content moves much faster (WM_MOTION_MOVE: pInfo->dx returns much higher values);
3rd window - content doesn't move at all (WM_MOTION_MOVE: pInfo->dy returns 0).
Here is the code using latest simulation package v6.26:
Display All
What am I doing wrong?
Thanks,
Alex.
my problem is following: here is a simple code with 3 simple windows with content inside the windows that can be moved using motion support.
1st window - content can be moved circularly.
2nd window - content can be moved horizontally.
3rd window - content can be moved vertically.
If I move content in 2nd and 3rd window all is fine and moves as it should.
But if I move content in 1st window with circular motion support and after that I try to move content in other windows then begins the following:
2nd window - content moves much faster (WM_MOTION_MOVE: pInfo->dx returns much higher values);
3rd window - content doesn't move at all (WM_MOTION_MOVE: pInfo->dy returns 0).
Here is the code using latest simulation package v6.26:
C Source Code
- #include "DIALOG.h"
- int x1, y1, ang1 = 0;
- int x2 = 10;
- int y3 = 10;
- void _cbWin1(WM_MESSAGE * pMsg) {
- WM_MOTION_INFO * pInfo;
- switch (pMsg->MsgId) {
- case WM_MOTION:
- pInfo = (WM_MOTION_INFO *)pMsg->Data.p;
- switch (pInfo->Cmd) {
- case WM_MOTION_INIT:
- pInfo->Flags = WM_CF_MOTION_R | WM_MOTION_MANAGE_BY_WINDOW;
- break;
- case WM_MOTION_MOVE:
- ang1 += pInfo->da;
- WM_InvalidateWindow(pMsg->hWin);
- break;
- case WM_MOTION_GETPOS:
- pInfo->xPos = ang1;
- break;
- }
- break;
- case WM_PAINT:
- GUI_SetBkColor(GUI_WHITE);
- GUI_Clear();
- GUI_SetColor(GUI_BLACK);
- GUI_DispStringHCenterAt("Radial motion", 100, 10);
- x1 = (int)(GUI__SinHQ(ang1 * 100) * 85 * 0.0000152587890625f) + 100;
- y1 = (int)(GUI__CosHQ(ang1 * 100) * 85 * 0.0000152587890625f) + 100;
- GUI_SetColor(GUI_RED);
- GUI_FillCircle(x1, y1, 10);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void _cbWin2(WM_MESSAGE * pMsg) {
- WM_MOTION_INFO * pInfo;
- switch (pMsg->MsgId) {
- case WM_MOTION:
- pInfo = (WM_MOTION_INFO *)pMsg->Data.p;
- switch (pInfo->Cmd) {
- case WM_MOTION_INIT:
- pInfo->Flags = WM_CF_MOTION_X | WM_MOTION_MANAGE_BY_WINDOW;
- break;
- case WM_MOTION_MOVE:
- x2 += pInfo->dx;
- if (x2 < 10)
- x2 = 10;
- if (x2 > 290)
- x2 = 290;
- WM_InvalidateWindow(pMsg->hWin);
- break;
- case WM_MOTION_GETPOS:
- pInfo->xPos = x2;
- break;
- }
- break;
- case WM_PAINT:
- GUI_SetBkColor(GUI_WHITE);
- GUI_Clear();
- GUI_SetColor(GUI_BLACK);
- GUI_DispStringHCenterAt("Horizontal motion", 150, 10);
- GUI_SetColor(GUI_BLUE);
- GUI_FillCircle(x2, 50, 10);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void _cbWin3(WM_MESSAGE * pMsg) {
- WM_MOTION_INFO * pInfo;
- switch (pMsg->MsgId) {
- case WM_MOTION:
- pInfo = (WM_MOTION_INFO *)pMsg->Data.p;
- switch (pInfo->Cmd) {
- case WM_MOTION_INIT:
- pInfo->Flags = WM_CF_MOTION_Y | WM_MOTION_MANAGE_BY_WINDOW;
- break;
- case WM_MOTION_MOVE:
- y3 += pInfo->dy;
- if (y3 < 10)
- y3 = 10;
- if (y3 > 290)
- y3 = 290;
- WM_InvalidateWindow(pMsg->hWin);
- break;
- case WM_MOTION_GETPOS:
- pInfo->yPos = y3;
- break;
- }
- break;
- case WM_PAINT:
- GUI_SetBkColor(GUI_WHITE);
- GUI_Clear();
- GUI_SetColor(GUI_BLACK);
- GUI_DispStringHCenterAt("Vertical motion", 50, 10);
- GUI_SetColor(GUI_GREEN);
- GUI_FillCircle(50, y3, 10);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void MainTask(void) {
- GUI_Init();
- WM_MULTIBUF_Enable(1);
- WM_SetDesktopColor(GUI_BLACK);
- WM_SetScreenSize(1024, 768);
- WM_CreateWindow(100, 100, 200, 200, WM_CF_SHOW, _cbWin1, 0);
- WM_CreateWindow(400, 100, 300, 100, WM_CF_SHOW, _cbWin2, 0);
- WM_CreateWindow(800, 100, 100, 300, WM_CF_SHOW, _cbWin3, 0);
- WM_MOTION_Enable(1);
- while (1) {
- GUI_Delay(50);
- }
- }
Thanks,
Alex.