Monday, May 21st 2018, 7:22am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Date of registration: Apr 5th 2018

Posts: 3

1

Tuesday, May 15th 2018, 2:50pm

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

Andrea


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.
andrea.laini has attached the following image:
  • FullSizeRender.jpg

Date of registration: Apr 5th 2018

Posts: 3

2

Tuesday, May 15th 2018, 3:36pm

My fault, re-reading the user manual at the decription of WM_SetWindowPos(), I've found the trick:

"xPos New position in X in desktop coordinates.
yPosNew position in Y in desktop coordinates."

Sorry