I use emWin 5.40 (STemWin provided by ST)
I tried this in the simulator:
Display All
the result is:
[img]https://s18.postimg.org/tb7t46r1l/hastrans_behaviour.png[/img]
and inside the dubugger rectangles are:
[img]https://s18.postimg.org/qtw1wzcax/debugger_rect.png[/img]
Why, when I set the WM_CF_HASTRANS flag, does the window I created seem to have the wrong size?
best regards
Max
I tried this in the simulator:
C Source Code
- #include "GUI.h"
- #include <stdlib.h>
- GUI_RECT Rect1;
- GUI_RECT Rect2;
- void Callback1(WM_MESSAGE *pMsg)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch (pMsg->MsgId)
- {
- case WM_PAINT:
- WM_GetInsideRect(&Rect1);
- GUI_SetBkColor(GUI_BLACK);
- GUI_SetColor(GUI_WHITE);
- GUI_ClearRectEx(&Rect1);
- GUI_DrawRectEx(&Rect1);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void Callback2(WM_MESSAGE *pMsg)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch (pMsg->MsgId)
- {
- case WM_PAINT:
- WM_GetInsideRect(&Rect2);
- GUI_SetBkColor(GUI_BLACK);
- GUI_SetColor(GUI_WHITE);
- GUI_ClearRectEx(&Rect2);
- GUI_DrawRectEx(&Rect2);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void MainTask(void)
- {
- GUI_Init();
- GUI_SetBkColor(GUI_GRAY_3F);
- GUI_Clear();
- WM_HWIN hWin1, hWin2;
- hWin1 = WM_CreateWindowAsChild(10, 10, 80, 45, WM_HBKWIN,
- WM_CF_SHOW , Callback1, 0);
- hWin2 = WM_CreateWindowAsChild(10, 60, 80, 45, WM_HBKWIN,
- WM_CF_SHOW | WM_CF_HASTRANS, Callback2, 0);
- GUI_Delay(20);
- while(1)
- {
- GUI_Delay(2000);
- }
- }
the result is:
[img]https://s18.postimg.org/tb7t46r1l/hastrans_behaviour.png[/img]
and inside the dubugger rectangles are:
[img]https://s18.postimg.org/qtw1wzcax/debugger_rect.png[/img]
Why, when I set the WM_CF_HASTRANS flag, does the window I created seem to have the wrong size?
best regards
Max