Redrawing partially hidden window

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Redrawing partially hidden window

    The main window of my display shows the clock updated every second
    When I open a dialog box that partially cover the clock how can I continue to update the clock?
    I tried with:
    WM_Invalidate (clock window handle), but put foreground all the clock window
    WM_InvalidateArea (clock area) but I have a bad flicker between the clock digits and dialog area
    The paint callback for clock window is

    C Source Code

    1. case WM_PAINT:
    2. hMem = GUI_MEMDEV_Create (p->x0, p->y0, p->size_x, p->size_y) ;
    3. GUI_MEMDEV_Select(hMem) ;
    4. GUI_Clear();
    5. grlcd_clock_update() ;
    6. GUI_MEMDEV_CopyToLCD(hMem) ;
    7. GUI_MEMDEV_Delete(hMem) ;
    8. break ;


    and the dialog is created with emWinGUIBuilder

    thanks
  • Hello,

    I would recommend using automatic Memory Devices for windows. This can be done by adding the following line to your application:

    WM_SetCreateFlags(WM_CF_MEMDEV);

    Please note that automatic Memory Devices are used for all windows which are created after the create flag WM_CF_MEMDEV was activated. Since the background window is created from within GUI_Init(), it is allowed to set create flags before the GUI is initialized.

    Best regards,
    Adrian
  • Thanks Adrian works perfectly!
    I'm sorry but I am a beginner user of emwin library

    I need another clarification on the use of timers:

    I have created a dialog with GUI_CreateDialogBox (...)

    In the dialog callback procedure I manage the message

    WM_NOTIFY_PARENT:
    under this message with some conditions I must start a timer and I call
    WM_CreateTimer (WM_GetClientWindow (pMsg-> hWin), ....)
    written as above it works and I get the WM_TIMER messages on dialog callback

    But I thought it was correct so
    WM_CreateTimer (pMsg-> hWin, .....)
    but in this case I don't receive WM_TIMER messages

    When you have a minute can you give me a brief explanation thanks