Hi,
When using the Window Manager it might get tricky to draw outside WM_PAINT.
1.
The pixel gets drawn but the next time a window gets drawn the pixel gets overwritten.
2.
A clip rect is set and the pixel won't get drawn because it is outside the clip rect.
3.
If you are using multibuffering and it is not visible because the pixel was drawn into the backbuffer.
Calling WM_InvalidateWindow() won't make the pixel visible. After calling WM_InvalidateWindow() nothing will happen before you enter GUI_Exec(). And then the drawing operations within WM_PAINT will be executed which will overwrite the pixel.
It is not recommend to draw outside WM_PAINT if using the Window Manager, because you won't know if it will be visible or not.
Is there a specific reason why you want to draw the pixel without WM_PAINT?
If you have created a single window which does not fill the entire screen and want to draw outside this window you have to draw within WM_PAINT of the desktop window (WM_HBKWIN).
The desktop window will have no callback per default but you can set one with WM_SetCallback(WM_HBKWIN, _cbBk).
|
C/C++ Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "DIALOG.h"
/*********************************************************************
*
* _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
GUI_Init();
WM_SetCallback(WM_HBKWIN, _cbBk);
while (1) {
GUI_Delay(100);
}
}
|
Regards
Sven