Widget reposition not working

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

    • Widget reposition not working

      Hi everybody,

      I'm trying to create a User Interface application with the STemWin library and I'm facing a problem with the reposition of existing widgets, in particular of BUTTONs.

      The "standard" structure of a window of my application is as shown:

      | Top toolbar |
      | E | | N |
      | m | | a |
      | p | | v |
      | t | CENTRAL | i |
      | y | | g |
      | | | a |
      | | | t |
      | | | e |

      Where there are 4 windows, all of them child of the background one.
      Now, currently "TopToolbar" and "Empty" are empty windows, without any child widget, while "Navigate" has just 2 buttons that allow the user to navigate up/down in the menu.
      The main window, where every relevant widget is built, is "CENTRAL" window: here I create the button I need, by setting "CENTRAL" as their parent. When created they are positioned at (0,0) of the Central window and by debugging I can see they do this correctly.

      When, after having created them, I try to re-position buttons, by calling WM_SetWindowPos() on the button handler, the get somehow re-positioned, but it seems this is done with respect to the origini of the background window, not the Central window as I expected.

      Googling I've found that re-drawing function, such as WM_SetWindowPos(), must be called in the callback function when WM_PAINT invoked: I've adjust my code accordingly, also setting the Central window as the active one, but nothing changes. You can see the result of re-positioning buttons in the image attached.

      Hope someone can give me any advice about how to solve it.
      Many thanks


      Everything works well, I can create buttons with the desired size, text, ... But for some window, I need to "layout" buttons according to their number and size, after having created them and positioned them at (0,0) by default.
      • FullSizeRender.jpg

        792.02 kB, 2,284×2,953, viewed 53 times