LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically adjust object's position/size while resizing a labview window

Although I tried to achieve this result, i.e. rescale and display buttons at proper positions after a panel resize event, I obtained very poor results. It would be nice if anyone could help me to find the proper way to do it. Please, find enclosed a sample file. There I have attempted to rescale a chart after labview panel has been resized...

if D0=(D0x,D0y) is a vector having FP sizes, prior resize, as its components,

and  D=(Dx,Dy) is a vector having the FP sizes, after resize, as its components,

I look for a Factors vector=(fx,fy) where fx=Dx/D0x  and fy=Dy/D0y

Provided that chart has dimensions d0x (horiz.) and d0y (vert.); if Z0=(z0x,z0y) is the vector pointing to pane origin and Z=(zx,zy) is the position of the chart (top-left corner) before resize,

I expect the position of the chart after resize operation to be Zf=(fx*(zx-z0x)+z0x,fy*(zy-z0y)+z0y). Moreover, after resize, the chart sizes should be fx*d0x (horiz.) and fy*d0y (vert.).

But so far, all this does not seem to be fully correct...as you can test on your own.

Regards,

Daniele Cannavo

0 Kudos
Message 1 of 24
(12,775 Views)

How about just setting the option in the VI's Properties:

 

 \

 

If you want to limit it to a single front panel object, right click on the control/indicator and select Scale Object with Pane.

Message Edited by smercurio_fc on 02-19-2009 11:33 AM
Message 2 of 24
(12,757 Views)

Sorry smercurio… but as far as I know -and I directly tested it on the field- about the resize functionalities of Labview ... they simply do not work "properly". Let me explain in more details what I mean. When you activate the option you proposed, upon a window resize event, Labview rounds numbers for size and position of each object without keeping memory of its original size and position. Therefore, after two or three resize events you can see odd effects such objects overlapped or having proportions distorted from the original ones. That is the main reason I am still looking for a "working" solution.

Regards,

Daniele 

0 Kudos
Message 3 of 24
(12,734 Views)
Did you try the second method I suggested? I guess I'm not seeing these artifacts that you mention. In your VI you seem to want to rescale the graph, so I took your VI, right-clicked on the graph and selected Scale Object With Pane, as I mentioned. As I resized the window the graph rescaled, and I did not see any artifacts. See attached mod. Can you provide a step-by-step procedure that generates these artifacts?
Message 4 of 24
(12,731 Views)

Please, have a look at this example: I arranged into a  group the chart with some other objects and I turned on the "Scale object with Pane". Try to make some resizing with it.

Daniele 

0 Kudos
Message 5 of 24
(12,727 Views)

In this particular case the problem occurs if you shrink the window too much. What can happen is that the button gets moved onto the graph. When you then enlarge the window, the button remains on top of the graph. In the VI I uploaded the graph was the only thing that was being resized. In that particular setup resizing did not create any crazy conditions.

 

In your original example you seem to only want to resize the graph. Are you trying to find a solution that applies to all objects on the front panel, or to a single object? If it's a single object then it appears to me that the example I provided should be adequate. If it's all objects, then you have a lot more to consider because you have to consider the size of the objects relative the positions. Technically, a resize of the panel should resize objects, and not move them. Your original VI seems to also move the graph. However, you can run into problems if the growth is too large. For instance, what do you do if you make the button so large that it would cover the LED? Also, which way is the LED grown? Diagonally towards the left and bottom, or radially?

Message 6 of 24
(12,699 Views)

I am not discussing about the fact that your example works quite well, but I was trying to find a way to control parameters on my own in order to find a valid approach to the problem (which, as you had to admit, is not generally solved). That is why I proposed a simple example, pointing out that something does not seem to work correctly. I was wondering if someone could help to figure out the possible reasons for that behavior. If you think my mathematical approach was not clear, just let me know and I will try to make it more clear. Regards,

Daniele

0 Kudos
Message 7 of 24
(12,683 Views)

Dear Mr. Cannavo,

 

I am responsible for you requests here at NI. If it is okay for you I will close your second SRQ dealing with the same subject and and will go on here in the forum.

 

My first question is, why do you expect users to change the window-size during run-time that much that you run into trouble?

The behaviour that LV shows is expected, because if you choose the property to resize the objects with the panel, LV expects that the user wants these visible objects to be visible during runtime. When you then make that window to small, LV moves one item one over the other, just to keep them in the visible area.

 

One thing you could do is just to set the minimum panel-size to that size that the objects are still in the right order (Property-classes>>VI-Server>>VI->Properties>>FrontPanelWindow>>MinimumSize). So the customer can rescale the panel as much as he likes until that minimum size.

 

Regards

Johannes

 

0 Kudos
Message 8 of 24
(12,646 Views)
Sorry if I could not reply earlier.  

It is ok to me if you proceed closing my additional SRQ as long as you will provide to me a "reasonable" answer, here in the forum.

I understand, that NI introduced in LabView some smart features handling window resize events. I am not a new LV programmer and I have tested extensively all the options that one could use. Still I consider that if a customer try to use the software on a pc with different screen specifications from the original ones, I should be able to know in detail how to tweak the program to suite requirements. Anyway, the MinimumSize does not say how small the window can be before you see serious "distortions". Referring to my original question, I really want to know why the way I am try to use fp bounds and other parameters is not working as I expected. I would appreciate an accurate discussion about meaning of parameters and expected numbers.

Regards,

Message 9 of 24
(12,626 Views)

Before suggesting a remedy I'd like a better explanation of the goal. Your VI attempts to adjust the position and size of the graph (though you seem to be specifically targeting the PlotAreaSize rather than the overall size of the graph control which implies you don't care about the legend, or other palettes). However, it only adjusts the font size of the label. Actually, come to think of it, why is the font size of the label being changed? Let's say the window is increased in size by 10 pixels in both directions. What do you expect the change in the size of the graph (plot area size) to be, and where do you expect the new position to be? Also, what do you expect the font size of the label to be? Same questions if the size is decreased by 10 pixels in both directions.

 

Basically, I can understand the resizing. What I don't get is the repositioning aspect.

0 Kudos
Message 10 of 24
(12,609 Views)