LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing controls problem

Hi folks!

When I try to resize some controls, they expand normally. But, when set then to the first size, they lost their proportions, font size etc....

Is there something that I can do to avoid it?

Regards.
Gustavo
0 Kudos
Message 1 of 4
(3,474 Views)

Hi Gustavo,

Before I make any assumptions of what's going on, could you please post a snapshot of the original panel, the panel after resizing, and then the panel after you programmatically set the font size back? Also, if you could post a snippet of CVI code as well that would be helpful.

Thanks

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 4
(3,460 Views)
As you can see, the first control is renderized using the defaults of the .uir file.

The second one, I used the mouse to make it bigger. I want that the control preserves the caractheristis of the first one (proportionally).

The third one, I tried to change it to the first state, I also tried to resize it using the mouse.

Regards
0 Kudos
Message 3 of 4
(3,456 Views)

Gustavo,

There are two separate issues:

1. You say that when you restore the panel to its original size, the control does not go back to its original proportions. But is that really true? In the screenshot that you submitted, the third panel isn't really the same size as the first. Can you confirm that if you really make the third panel the same size as the first the control doesn't go back to its original size?

2. You've probably noticed that as you resize the panel, you start seeing overlapping between the gauge and the digital display, as well as ovelapping of the numeric labels inside the gauge. The reason for this is because the gauge must always be circular. So, imagine that you're resizing your panel such that the width grows by a factor of 4, and the height grows by a factor of 3. What CVI does in that case is that it repositions and grows every part of every control by a factor of 4, widthwise, and a factor of 3x, heightwise. This works just fine for most controls that can be sized independenly in both directions. However, gauges cannot be sized independently in both directions. They must always be circular. Therefore, what CVI does instead is that it sizes its radius by a factor of 3.5 (halfway between 3 and 4). So, since the digital display is moving down by a factor of 3, but the gauge is moving down by a factor of 3, but growing down by a factor of 3.5, an overlap occurs. There really is no good solution to this. If instead you were to grow the height more than the width, you'd be left with a gap that is too large, rather than an overlap. The same phenomenon causes the labels to be overlapped: the font grows horizontally more than the gauge does.

This is a limitation of this feature, and is something you have to be aware of. If you enable "scale contents on resize", and you have knobs, gauges and meters in your panel, you're going to end up with some loss of proportionality whenever you grow your panel in a non-proportional fashion. If you want to avoid overlaps, you'll have to leave a large enough gap in the original panel layout. But it should be the case that as you go back to the original panel size, the controls also go back to their original sizes.

Luis

0 Kudos
Message 4 of 4
(3,415 Views)