GUI_MEMDEV_CopyFromLCD() and GUI_MEMDEV_CopyToLCD()

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

  • GUI_MEMDEV_CopyFromLCD() and GUI_MEMDEV_CopyToLCD()

    I have implemented the following function to show an eror message line
    at the bottom of the screen and expected, that after the function
    GUI_MEMDEV_CopyToLCD(hMem);
    my old content of the display appears again. But this does not work.
    I see still the error message line on my screen.


    void ShowErrorMessageLine(int ErrorCode, int Time, char *pErrorString)
    {
    GUI_RECT rect={0, LCD_LINES-LCD_SIZE_SOFTKEYBAR, LCD_COLUMS-1, LCD_LINES-1};
    GUI_MEMDEV_Handle hMem;
    PushGrafikSettings();
    hMem = GUI_MEMDEV_CreateFixed32(rect.x0, rect.y0, LCD_COLUMS, LCD_SIZE_SOFTKEYBAR);
    GUI_MEMDEV_CopyFromLCD(hMem);
    GUI_SetBkColor(GUI_RED);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(pFontMenuText);
    GUI_ClearRect(rect.x0,rect.y0,rect.x1,rect.y1);
    if (ErrorCode)
    GUI_DispStringInRectWrap(GetTextVonSprache(ErrorCode),&rect,GUI_TA_VCENTER|GUI_TA_HCENTER,GUI_WRAPMODE_WORD);
    else
    GUI_DispStringInRectWrap(pErrorString,&rect,GUI_TA_VCENTER|GUI_TA_HCENTER,GUI_WRAPMODE_WORD);
    GUI_Exec();
    GUI_Delay(Time);
    GUI_MEMDEV_CopyToLCD(hMem);
    GUI_MEMDEV_Delete(hMem);
    PopGrafikSettings();
    }

    Has anybody an idea, what the problem can be?
    Many thanks in forward
    Andreas
  • Hello Andreas,

    I checked it with the code below. It is almost the same as your code and it is working just fine.

    C Source Code

    1. #include "DIALOG.h"
    2. void ShowErrorMessageLine(int ErrorCode, int Time, char *pErrorString) {
    3. GUI_RECT rect={0, 200, 479, 271};
    4. GUI_MEMDEV_Handle hMem;
    5. hMem = GUI_MEMDEV_CreateFixed32(rect.x0, rect.y0, 480, 72);
    6. GUI_MEMDEV_CopyFromLCD(hMem);
    7. GUI_SetBkColor(GUI_RED);
    8. GUI_SetColor(GUI_WHITE);
    9. GUI_ClearRect(rect.x0,rect.y0,rect.x1,rect.y1);
    10. GUI_DispStringInRectWrap(pErrorString,&rect,GUI_TA_VCENTER|GUI_TA_HCENTER,GUI_WRAPMODE_WORD);
    11. GUI_Exec();
    12. GUI_Delay(Time);
    13. GUI_MEMDEV_CopyToLCD(hMem);
    14. GUI_MEMDEV_Delete(hMem);
    15. }
    16. /*********************************************************************
    17. *
    18. * Public code
    19. *
    20. **********************************************************************
    21. */
    22. void MainTask(void) {
    23. GUI_Init();
    24. GUI_DrawGradientH(0, 0, 480, 272, GUI_BLACK, GUI_GRAY);
    25. while(1) {
    26. GUI_Delay(1000);
    27. ShowErrorMessageLine(0, 1000, "Error");
    28. }
    29. }
    Display All


    Please give it a try and check if this is running on your side.

    Are you using the Window Manager?

    If this is the case please do not draw anything outside of WM_PAINT. When using the Window Manager, such a pop up should be created using a window.

    Btw. you got a valid license which includes support, so don't hesitate to contact us directly ;)

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.