07-29-2019 03:45 AM
I want to programmatically change the size and position of all front panel objects at once depending on the window size/resolution. I have tried doing this for 3 objects and it works.
I calculate a ratio between the size of object and the current size of the window, then use this ratio to calculate the new size (ratio x new window size) and assign it through property nodes.
For position I calcuate the relative position of the object in the window in x and y coordinates and assign a new position depending on the new window size.
But my final application will contain many objects on different tabs. So doing this manually for each object is tedious. I have tried to get a reference of some objects on the front panel to do this, but there are 2 problems I face now. Changing the position results in objects flying outside the labview window and then labview crashes. Also I am unable to address the size of the objects through references (although the objects are identical so their properties are identical).
regards
07-29-2019 03:55 AM
Hi Valdievel,
Changing the position results in objects flying outside the labview window and then labview crashes.
You need to catch such (calculation!) problems before writing to the property!
Also I am unable to address the size of the objects through references (although the objects are identical so their properties are identical).
Why are you unable to do so?
There are properties to change the width of elements, like "TextWidth" for numeric controls…
07-29-2019 04:28 AM
You need to catch such (calculation!) problems before writing to the property!
I tried to manually give the same position that has been calculated by the code I uploaded in the image and manually doing so results in no errors and the objects move to the new position.
Why are you unable to do so?
There are properties to change the width of elements, like "TextWidth" for numeric controls…
If I am adressing several objects at once through references, then I don't find this property in the property node. But adressing each object individually allows to do so.
I have posted a simplified version of my application, I am afraid it will be an eyesore...but excuse my I am still a beginner.
May you take a look at it when you have time? Start it and see how it behaves, then remove the digram deactivation structure to start it again to see the objects fly when you maximize the window screen (the square button).
best regards
07-29-2019 04:41 AM
07-29-2019 04:49 AM
Hallo GerdW,
attached you can find a LV2017 vi
best regards
07-29-2019 04:53 AM - edited 07-29-2019 04:56 AM
07-29-2019 04:58 AM
Hallo GerdW,
I have opened the VI after I converted it to 17 then saved it! So probably has been changed it to 18 ![]()
Now I hope it is the right version, otherwise it will be embarassing ![]()
Best regards
07-29-2019 05:28 AM
Hi Valdievil,
now I can load the VI!
As I said before: you need to check your calculations when trying to place controls!
Most coordinates are based on origin of the panel or pane…
Hint:
You should not depend on the index of an element in the array of control references, use the control label and/or datatype instead.
Why do you hide elements onn tab pages? It could be easier to use a subpanel and splitter bars in a subVI…
07-29-2019 06:36 AM
07-29-2019 11:42 AM
Have you tried just turning on the VI property "Scale all objects on front panel as the window resizes" ?