lpcware

Flicker problem with "ownerdrawn" buttons - emWin lib

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by Grisu on Thu Feb 16 09:31:58 MST 2012
Hi everyone,

I need very urgent a solution for this problem:
I use many dialogs in my application. To realize ownerdrawn buttons I set their transparency flag with WM_SetHasTrans(hBtn).
Then I copy a memory device with a drawn JPEG image into the buttons area. This happens in the WM_PAINT of the dialog callback function.
The WM_PAINT in the buttons callback function is empty.

C/C++ Source code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19void  CPage::CallbackButton(WM_MESSAGE * pMsg)
{
  switch (pMsg->MsgId)
  {
  case WM_PAINT:
    break;
  default:
    BUTTON_Callback(pMsg);
    break;
  }
}

void CPage::CallbackDialog(WM_MESSAGE * pMsg)
{
  switch (pMsg->MsgId)
  {
  case WM_PAINT:
    m_CurrentPage->WM_Paint();
    break;


And this is the annoying problem: With every click/release the button area flickers with the transparent color, before the image is seen.
To use bitmap buttons instead is no option because there is not enough space for many button bitmaps in the flash memory.

Is there any other way to show "image" buttons without flickering?
Or is it possible to avoid the seen click/release state of buttons ?

Thanks in advance
Grisu

Outcomes