How to set the border size of a window

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

    • How to set the border size of a window

      in the emWin 5.40 reference manual I find:
      --------------------------------
      WM_GetInsideRect()
      Description

      Returns the coordinates of the client area of the active widget less the border size.
      The function sends a message to the active window to retrieve the inside rectangle.
      If the widget does not handle the message (that means the widget has no border)
      WM_GetClientRect will be used to calculate the rectangle. The result is given in win-
      dow coordinates. That means x0 and y0 of the GUI_RECT structure corresponds to
      the border size in x and y, x1 and y1 corresponds to the size of the window less the
      border size - 1.
      ---------------------------

      He talks about a window border.
      I am writing a new custom widget, how do I set the border, for example 1 pixel, so that WM_GetInsideRect() considers it?

      best regards
      Max
    • Hi,

      I am writing a new custom widget, how do I set the border, for example 1 pixel, so that WM_GetInsideRect() considers it?
      Your custom widget has to react on WM_GET_INSIDE_RECT and set the data pointer of the message.

      Like this:

      C Source Code

      1. case WM_GET_INSIDE_RECT:
      2. pRect = (GUI_RECT *)(pMsg->Data.p);
      3. pRect->x0 = 1;
      4. pRect->y0 = 2;
      5. pRect->x1 = 3;
      6. pRect->y1 = 4;
      7. break;


      How the border is calculated is up to you. You could use the rectangle return by WM_GetClientRect() and reduce it about the border size.

      I think we should adapt the manual at this point, since the message WM_GET_INSIDE_RECT is not documented.

      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.