LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for an elegant way to manipulate main VI from Sub VI

After posting my initial idea, i got a lot of feedback that i needed to use a typedef cluster instead of a string search. I did a quick test in a loop trying to see which way is faster to referance something. I discovered after analyzing that:
- The typedef cluster is 3 times faster than using a string to search. I was searching a list of only two front panel varaibles. By that token it will get MUCH slower if i had more.
- Operationally the search string was slow enough to affect my timed loop. The operation was jerky and slow, by human standards.

Conclusion -  dont follow my earlier post suggestion. Listen to the guys with more stars.

As a side note, i was happy with a little program that creates an array of every value on the front panel. It can also re-initalize the front panel to the previous values. Other than that, the typedef method is far superior.
0 Kudos
Message 11 of 14
(1,883 Views)

Thanks Darren for the comprehensive step by step guide... I finally managed to get it right!!

I was having a problem with getting the correct datatype from the 'value' property but i managed to resolve it by 'including the datatype' in the typedef of the ctrl ref.  Continuing on the point, when do you suggest we should include the datatype and when not to.  Just curious...

Thanks once again for the great tip...

Zulfi

0 Kudos
Message 12 of 14
(1,871 Views)

If you plan on ever using the Value property on a control that can have different datatypes (Listbox, Radio Buttons, etc.), you should include the datatype.  If you ever plan on writing subVIs that take a non-datatype-specific reference (like a subVI that takes in a Listbox reference, where you may be dealing with both single-select listboxes and some multi-select listboxes), then you should not include the datatype, so the subVI would be able to take both kinds of control references without giving you a broken wire.

There are probably other reasons, but those are the first things that come to mind.

Hope this helps,
-D

0 Kudos
Message 13 of 14
(1,869 Views)

Thanks for the help Darren.  Its really been most helpful.

Zulfi

0 Kudos
Message 14 of 14
(1,858 Views)