LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

OnChange for global variable?

Is it possible to use an Event structure with a global variable?

I read data into a global variable in one subVI (in a loop), and would like to process the data in another subVI, as it changes. I thought I could use an Event Structure, using the ValueChange event for the global variable holding the data, but I can't see any of my global variables in the Event Source list.
0 Kudos
Message 1 of 3
(3,095 Views)
> Is it possible to use an Event structure with a global variable?
>
> I read data into a global variable in one subVI (in a loop), and would
> like to process the data in another subVI, as it changes. I thought I
> could use an Event Structure, using the ValueChange event for the
> global variable holding the data, but I can't see any of my global
> variables in the Event Source list.

There are really two issues here. The dialog will only list the items
in the front panel, and those wired into its registration terminal. To
be able to notice value changes from another panel, and I presume from a
global, you will need LV7 and dynamic registration. Secondly, the value
change event fires not when written to, but when the user interacts with
it. There i
s a Signalling Value Change that may work, but I haven't
tried it on globals.

Greg McKaskle
0 Kudos
Message 2 of 3
(3,095 Views)
You can do this however it is not necessarily clean or straight forward.
To do it you need to:
In the VI that has the event structure, open up a reference to the global then to the global�s controls and index out the control you want. Once you have a reference to the global�s control, you register a value change event for that control reference.

Now in the VI that sets the global�s value you need to follow Greg's advice and rather than setting it normally you need to use the value signaling property. So again you must open a reference to the global then the controls and then index out the control you want. Finally call the value signaling property.
0 Kudos
Message 3 of 3
(3,095 Views)