Creating a memory device with a dialog

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

    • 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/Thread/8148-get-data-pointer-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 Source Code

      1. xPos = WM_GetWindowOrgX (pMsg->hWin);
      2. yPos = WM_GetWindowOrgY (pMsg->hWin);
      3. xSize = WM_GetWindowSizeX(pMsg->hWin);
      4. ySize = WM_GetWindowSizeY(pMsg->hWin);
      5. hMem = GUI_MEMDEV_Create(xPos, yPos, xSize, ySize);
      6. GUI_MEMDEV_CopyFromLCD(hMem);
      Attached is an example doing this.

      Regards,
      Sven
      Files
      • MainTask.zip

        (1.28 kB, downloaded 683 times, last: )
      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.
    • 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.
      Files
      • Main.zip

        (1.45 kB, downloaded 609 times, last: )
      Regards,

      Anthony

      The post was edited 1 time, last by cilmagemlu ().

    • 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