LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get control value from vi reference

Hi everybody,

we would like to access a control value within a statechart from a reference to the main vi. The way we managed to get the control value is shown below (using an invoke node). Is there any way to choose the control from the right-mouse-button-menu explicitely (i.e. without passing the name of the control as a string and avoiding type casting)?

Thanks in advance for any hints.

0 Kudos
Message 1 of 2
(5,431 Views)


@WernerGobel wrote:
Hi everybody,

we would like to access a control value within a statechart from a reference to the main vi. The way we managed to get the control value is shown below (using an invoke node). Is there any way to choose the control from the right-mouse-button-menu explicitely (i.e. without passing the name of the control as a string and avoiding type casting)?

Thanks in advance for any hints.






Hi Werner,

the VI reference is designed to refer to any type of VI. Therefore, it cannot predict which controls will be included in the VI it represents during runtime.

This is the reason why there is no way of creating a context menu with all the controls that you have used in a specific VI.


Having written this, I might have an alternative for you in case you are interested in reading the values of multiple controls in your state diagram. There is a FrontPanel property called 'Controls[]' that returns an array of all controls in the specified VI. The order of the refnums is set trough the tabbing order (Menu -> Edit -> Set Tabbing Order). So in case you e.g. want to read the values of the second, the fifth and the seventh control, you would index the array and read the controls' values trough the corresponding reference and property node...



Best regards,
Sebastian



Message Edited by SFK on 02-18-2008 07:11 PM
Message 2 of 2
(5,356 Views)