Creating a memory device with a dialog

  • Hello to everyone,

    I need to create a memory device with a content of a dialog window.

    There was an old thread https://forum.segger.com/index.php/Thre…nter-in-window/ and undocumented function GUI_MEMDEV_CreateWindowDevice() was mentioned there.

    When I use that function I get a memory device with a content of a parent window.

    But how to get a memory device with a content of a whole dialog with all child widgets?

    Of course we can use WM_ForEachDesc() with GUI_MEMDEV_CreateWindowDevice() for all descendants and "collect" such a content in a one device.

    But maybe there is a more simple way to do this.

    Thanks.

    Regards,

    Anthony

  • Hi,

    Unfortunately, there is no dedicated API function to copy an entire dialog into a memory device.

    But, you can create a memory device with the same size as the dialog at the same position and copy the LCD content into the memory device.

    This might look like this:

    C
    xPos  = WM_GetWindowOrgX (pMsg->hWin);
    yPos  = WM_GetWindowOrgY (pMsg->hWin);
    xSize = WM_GetWindowSizeX(pMsg->hWin);
    ySize = WM_GetWindowSizeY(pMsg->hWin);
    hMem = GUI_MEMDEV_Create(xPos, yPos, xSize, ySize);
    GUI_MEMDEV_CopyFromLCD(hMem);

    Attached is an example doing this.

    Regards,
    Sven

  • Hello, Sven,

    thanks for your sample, works fine, but unfortunately it is not quite suitable for me. I need to create a device from a dialog that should not be visible on the screen. In addition a dialog can contain transparency so background should not count in that case.

    I attached my sample with a simple code scenario that collects all hidden dialog pixel data into a one device. Works fine except for one thing: after the dialog is shown when clicking on a child widget others widgets become hidden. I think it might be about some incomplete actions (maybe GUI context lost etc...). Maybe you can tell how to do this "icing on the cake".

    Thank you.

  • Hello,

    for those who are interested: the problem is solved by calling

    GUI_MEMDEV_FadeInWindow(WM_HBKWIN, 0);

    after the dialog is shown.

    In this case the main job of this function has no meaning but somehow it sets things right.

    Can't explain furhter as I use STemWin and don't have source files to better understanding.

    Regards,

    Anthony

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!