Showing results for 
Search instead for 
Did you mean: 

Create new scaled control in maximized window



I need to create new numeric controls in my UI while the program is running. These controls are sized after the size they have in the uir file. They are resizable, so if I create a control and then maximize the window it grows as it should. But if I create the control while the windows is already maximized it gets the smaller original size, and becomes even smaller if I minimize again. How can I make the new control be sized according to the current scale of my window, like it would have been if it was created at program start?


ATTR_CAN_MAXIMIZE/ATTR_CAN_MINIMIZE are apparently not valid for the control, so I can't use that. I have set the resolution adjustment to 100 %, and Scale Contents On Resize is set.



0 Kudos
Message 1 of 2

Let's see if a different approach can suit your needs: since you are scaling panel and controls at the same time, panel free area does not change (I mean that the available space for new controls is the same in reduced and expanded size since controls expand as well).

Given this, you are not supposed to be able to create more than a reasonable number of controls in your panel either in reduced or expanded size; I wonder whether in this scenario a number of hidden controls already present in your panel can be a valid alternative: adding a new control will thus be simply a process of choosing the first available hidden control, customize it according to operator needs and show it. On the other hand, discarding the control will simply mean hiding it. Hidden controls will expand the same way as visible ones and you'll have no need to struggle with control attributes while programmatically creating new controls.


A different scenario is if you use splitters to resize some of the controls leaving the others unaffected: in this case you'll have more available space in expanded case to create new controls.

Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2