Hi,
I have a strange effect:
I have a dialog box with a blue background and few checkboxes and similar.
When the focus changes from one widget (checkbox e.g.) to another widget, then the area around the widgets is incomprehensively first cleared/filled with white color before(!) receiving the WM_PAINT message in which I clear to my dedicated color (blue). This effect is recognized as a kind of short "flashing".
I reproduced it with emWinView in the Simulator to evaluate this. And I tried many but could not find a solution to prevent this disturbing effect.
Further details:
Clearing to white happens AFTER the dialog callback has processed the WM_PRE_PAINT message but immediately BEFORE it recieves the WM_PAINT message.
Then the WM_PAINT message is processed by me e.g. to draw the background in the dedicated color (different from white).
This effect is not seen when using memory devices (which I cannot use because of low availibe RAM).
Disadvantage:
a. On slow systems a very poor 'flashing' (white) is seen.
b. It costs performance because the area is drawn twice (once unnecessarily in white, and then within WM_PAINT in the dedicated color).
I assume, that when using memory devices it cost performance (time) too whitout seen the "flashing".
I use a fast LCD interface with parallel 16 bit, so output performance is not a critical issue. But because I dont use a white background the "flashing-white" is inconvinient.
Who is drawing the white area??? What have I to do, to eliminate this "clearing to white"?
Here is a short sample source for reproducing it (should run in the simulator):
Display All
Can anyone help me?
Matz
I have a strange effect:
I have a dialog box with a blue background and few checkboxes and similar.
When the focus changes from one widget (checkbox e.g.) to another widget, then the area around the widgets is incomprehensively first cleared/filled with white color before(!) receiving the WM_PAINT message in which I clear to my dedicated color (blue). This effect is recognized as a kind of short "flashing".
I reproduced it with emWinView in the Simulator to evaluate this. And I tried many but could not find a solution to prevent this disturbing effect.
Further details:
Clearing to white happens AFTER the dialog callback has processed the WM_PRE_PAINT message but immediately BEFORE it recieves the WM_PAINT message.
Then the WM_PAINT message is processed by me e.g. to draw the background in the dedicated color (different from white).
This effect is not seen when using memory devices (which I cannot use because of low availibe RAM).
Disadvantage:
a. On slow systems a very poor 'flashing' (white) is seen.
b. It costs performance because the area is drawn twice (once unnecessarily in white, and then within WM_PAINT in the dedicated color).
I assume, that when using memory devices it cost performance (time) too whitout seen the "flashing".
I use a fast LCD interface with parallel 16 bit, so output performance is not a critical issue. But because I dont use a white background the "flashing-white" is inconvinient.
Who is drawing the white area??? What have I to do, to eliminate this "clearing to white"?
Here is a short sample source for reproducing it (should run in the simulator):
C Source Code
- /*********************************************************************
- HOW TO REPRODUCE:
- 1. Start Simulation and emWinView
- 2. Start this sample
- 3. Then set breakpoints after executing WM_PRE_PAINT and before
- executing WM_PAINT (see marking ####).
- 4. Change the focus to any other unfocussed widget.
- => breakpoint after WM_PRE_PAINT is reached.
- 5. In the Simulator Press Run [F5]
- => breakpoint when receiving WM_PAINT is reached.
- => In the emView you can see the white-cleared areas! <=== !!!!!
- 6. Press [F10] twice to see this area been filled by the own
- WM_PAINT statements with the dedicated color.
- 7. Press [F5] to contiue
- Step 4. to 7. could be repeated.
- *********************************************************************/
- /*********************************************************************
- * SEGGER ...
- */
- #include <stddef.h>
- #include "GUI.h"
- #include "DIALOG.h"
- /*********************************************************************
- * Dialog resource
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { FRAMEWIN_CreateIndirect, "Framewin", 0, 30, 5, 260, 230, 0, 0 },
- { BUTTON_CreateIndirect, "OK", GUI_ID_OK, 10, 30, 100, 20 },
- { BUTTON_CreateIndirect, "Cancel", GUI_ID_CANCEL, 10, 60, 100, 20 },
- { CHECKBOX_CreateIndirect, "Check1", GUI_ID_CHECK0, 10, 90, 100, 20 },
- { CHECKBOX_CreateIndirect, "Check2", GUI_ID_CHECK1, 10, 120, 100, 20 },
- };
- /*********************************************************************
- * Background Callback only to have a different background color
- */
- static void _cbBkWindow(WM_MESSAGE* pMsg) {
- switch (pMsg->MsgId) {
- case WM_PAINT:
- GUI_SetBkColor(GUI_RED);
- GUI_Clear();
- break;
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- * Dialog Callback
- */
- static void _cbCallback(WM_MESSAGE * pMsg) {
- WM_HWIN hWin, hClient;
- hWin = pMsg->hWin;
- switch (pMsg->MsgId) {
- case WM_PRE_PAINT:
- WM_DefaultProc(pMsg);
- // #### Put a breakpoint at the next line:
- __nop();
- break;
- case WM_PAINT:
- // #### Put a breakpoint at the next line:
- // Area has unnecessarily been cleared to white before receiving this WM_PAINT message!
- // And now the area is again cleared to the dedicated color.
- GUI_SetBkColor(GUI_LIGHTBLUE); // dedicated dialog background color.
- GUI_Clear();
- break;
- case WM_INIT_DIALOG:
- CHECKBOX_SetText(WM_GetDialogItem(hWin, GUI_ID_CHECK0), "Checkbox 1");
- CHECKBOX_SetText(WM_GetDialogItem(hWin, GUI_ID_CHECK1), "Checkbox 2");
- break;
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- *
- * MainTask
- */
- void MainTask(void) {
- // WM_SetCreateFlags(WM_CF_MEMDEV); // DONT use memory devices to demonstrate the effect
- GUI_Init();
- WM_SetCallback(WM_HBKWIN, &_cbBkWindow);
- GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, WM_HBKWIN, 0, 0);
- }
- /*************************** End of file ****************************/
Can anyone help me?
Matz