MULTIEDIT with widget on top

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

    • MULTIEDIT with widget on top

      Hi,

      I have MULTIEDIT window with a close button. The button works fine unless I move the scrollbar - then it disappears. Is there a simple way to keep the button visible on top?

      Best regards
      Jan
    • Hi,

      Is the button a child window of the MULTIEDIT? In my test moving the scrollbar of a MULTIEDIT did not affect the visibility of the button.

      C Source Code

      1. WM_HWIN hEdit;
      2. WM_HWIN hButton;
      3. GUI_Init();
      4. hEdit = MULTIEDIT_CreateEx(10, 10, 100, 100, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_MULTIEDIT0, 1000,
      5. "Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7\nLine8\nLine9\nLine10\nLine11\nLine12");
      6. hButton = BUTTON_CreateEx(2, 2, 20, 20, hEdit, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
      7. MULTIEDIT_SetAutoScrollV(hEdit, 1);

      Can you send me a small example to reproduce this behavior?

      Thanks and best regards,
      Florian
      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.
    • Thank you, Florian. I had forgotten WM_AttachWindowAt() to make the button a child of MULTIEDIT. Now it stays on top when I move the slider. But it still doesn't work as intended. When I touch the button I receive the notification from the MULTIEDIT in the background. The notification of the button does not respond. When I disable the MULTIEDIT there are no notifications from the text area but the button still doesn't work. Is the button also disabled then because it is a child window? What am I doing wrong?
      Thank you

      Best regards
      Jan

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

    • Hi,

      When a button is pressed or released, a WM_NOTIFY_PARENT message is sent to the parent of the button widget. So in this case, the MULTIEDIT would receive this message. You can also read about this in the user manual.

      To process the message, you have to set a callback routine to the MULTIEDIT that reacts on the WM_NOTIFY_PARENT message:

      C Source Code

      1. static void _cbEdit(WM_MESSAGE * pMsg) {
      2. int NCode, Id;
      3. switch(pMsg->MsgId) {
      4. case WM_NOTIFY_PARENT:
      5. Id = WM_GetId(pMsg->hWinSrc);
      6. NCode = pMsg->Data.v;
      7. switch (Id) {
      8. case GUI_ID_BUTTON0:
      9. switch (NCode) {
      10. case WM_NOTIFICATION_CLICKED:
      11. //
      12. // Button clicked
      13. //
      14. break;
      15. case WM_NOTIFICATION_RELEASED:
      16. //
      17. // Button released
      18. //
      19. break;
      20. }
      21. break;
      22. }
      23. break;
      24. default:
      25. MULTIEDIT_Callback(pMsg);
      26. }
      27. }
      Display All

      To set a callback routine to a widget, use WM_SetCallback().

      Best regards,
      Florian
      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.