08-09-2011 05:54 AM
Can we link an event case in one VI to a control on another VI or to a global variable in the same project?
I have a top level VI which has quit and abort buttons in it. Rather than copy these buttons to all the other, popup VIs it would be much neater if the popup VIs could respond to events on the top level front panel. However, in LV 2010 this doesn't seem to be possible using event cases, so I re-wrote it using select case in while loops. This is what we used to do in the 'old days' of LV 6 but not as neat.
Solved! Go to Solution.
08-09-2011 06:02 AM
Have a look at the dynamic event registration. There are also examples on this topic. This will allow you to react on events of controls on other VIs. Exactly what you need. You just need the control reference to register the event.
There are no events on global variables.
08-09-2011 09:26 AM
Thanks Dan_u,
I read up on registering events with interest, and will try it out in future. It does, however, seem to me to be a slightly '
busy' way of doing it. Howcome we can't just select a control on another VI from within the normal event case menu? So long as the VI is in the same project this seems reasonable to me. Likewise having an event for change of value on global variables. Regards, Barnsey
08-09-2011 09:54 AM
A different VI has a different FrontPanel, so VI A is not aware of the controls on another VI B. Dynamic events provide a nice and easy way to handle events remotely.
There's also no "direct" way to write a value to a control that is on another VI. You need a reference to the control or implement another way to transfer data.