LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get all objects located on the front panel?

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

0 Kudos
Message 1 of 20
(4,023 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 20
(4,014 Views)

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

 

0 Kudos
Message 3 of 20
(3,993 Views)

Hi Valdievil,

 

do you mind to attach a down-converted version of your VI? LV2017 would be fine…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 20
(3,981 Views)

Hallo GerdW,

 

attached you can find a LV2017 vi

 

best regards

0 Kudos
Message 5 of 20
(3,976 Views)

Hi Valdievil,

 

unfortunately you still attached a VI for LV2018…

(Save for previous, select LV2017.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 20
(3,971 Views)

Hallo GerdW,

 

I have opened the VI after I converted it to 17 then saved it! So probably has been changed it to 18 Smiley Tongue

 

Now I hope it is the right version, otherwise it will be embarassing Smiley Very Happy

 

Best regards

0 Kudos
Message 7 of 20
(3,964 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 20
(3,954 Views)

Have you tried just turning on the VI property "Scale all objects on front panel as the window resizes" ?

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 10 of 20
(3,884 Views)