From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 7.1: menu driven event structure question: How can I cause an event case to fire when either a boolean object or a menu item is selected without polling?

I am using an event structure to eliminate the overhead associated with polling from the GUI. I have build cases associated with each front panel button, and would like to programmatically generate a menu for the vi, adding each selection from the menu to its associated case. However adding a "user event" to a case that is already associated with a front panel button does not seem to allow the selection of the associated user event. Do I have to register each option on the custom menu? Should I programmatically generate the menu and use the same array to register the choices? Are there any examples out there
that would help me?
Thanks!!!!

Steve
0 Kudos
Message 1 of 5
(3,048 Views)
Hi Steve,
Your best bet would be to have one event case for your entire menu which switches on the item tag of the selected item, and then a seperate event case for each button. The cases in the menu event and the button events could share SubVIs to avoid re-writing code. I've attached a short example that dynamically creates a menu and then handles the events for it.

Regards,
Ryan K.
0 Kudos
Message 2 of 5
(3,048 Views)
Ryan:
Thank you for your answer! It's unfortunate that menu events can't be registered in some way so that an event case could be triggered by either a front panel control change or the menu selection. I will try some variation of what you have suggested and use sub VIs to minimize duplication of code.
Thanks again

Steve
0 Kudos
Message 3 of 5
(3,047 Views)
Hello:

I visited the forum for the purpose of getting some ideas on user events architecture. Well, I have to finished standalone working modular VI codes one which works as a standalone local control and one  which works on a remote communications mode. Now these  codes in themselves has event driven capabilities my problem is I needed to create another topmost layer VI that will be capable of switching between these remote and local operating mode - which I was thinking also to be event driven. This maybe a poor idea but I tried anyway. Is the User Event loop can be nested? Meaning an event within an event thing?

Regards,

Berns B.

Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 4 of 5
(2,840 Views)
In the LabVIEW help for events there is a section called "Caveats and Recommendations when Using Events in LabVIEW" in which it cautions against using two events within a loop. I'm not certain whether nesting two events, one within the other is exactly what is being cautioned against, but it probably isn't a good idea. Can you not just have all of the events handled in one event structure? Alternately, can you have the high level event call sub-vi's, where you would handle the other set of events?
 
P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 5 of 5
(2,830 Views)