LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating Menu Items

Hi guys,

 

I'm playing around with NXG, trying to replicate my .NET application.

I'm attempting to create a simple Menu structure, and have some events happen when certain Menu items are selected.

Could someone enlighten me, as to why the attached program doesn't work?

I want to click File/Load sequence/- select an item here, and when clicked other items should enable/disable their state and modify the checked state.

This is so simple to do in C#, I don't understand why my diagram doesn't work. Could someone point out what I'm doing wrong, I would be very grateful.

 

Edit:

I'm guessing it's Case selector, I'm passing the Item name into it but I'm not sure how NXG links the cases to the selector, I just typed in the cases by hand, is that enough?

I know the Menu is referenced correctly, because if I change the Default Case I can see the changes on the Menu Items...

 

Thanks

0 Kudos
Message 1 of 7
(1,861 Views)

I don't have NXG, but I'd add a One button dialog or Indicator or Probe to see what's actually passed to the event.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 7
(1,803 Views)

Hi, thanks for your reply and suggestion, I used One button, and I could see that noting was being passed.

 

I got it going now.

I used an Event Structure, my event case is Menu selection (User). Then I pass the ItemTag to a string, and use that string as Selector in my Case Structure.

 

 

Message 3 of 7
(1,770 Views)

@mattcrow wrote:

I used an Event Structure, my event case is Menu selection (User). Then I pass the ItemTag to a string, and use that string as Selector in my Case Structure.


Nice! That sounds about right. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(1,760 Views)

Here's a quick snapshot:

menu selection.png

0 Kudos
Message 5 of 7
(1,757 Views)

Almost there.

As the event structure will fire when you select something it'll work better if you place the Case inside the Event. If it's meant to set some sort of mode it should still be inside the Event, but in a Timeout structure and the Selected item should be wired through a Feedback loop.

As it stands, you'll get a Race condition, or rather a guaranteed delay of one selection. I can almost guarantee that the read of SelectedItemTag will happen before the Write in the event happens, thus you'll constantly read the previous value. If you move the case inside and wire directly that's not an issue.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(1,754 Views)

Hmm... You got me confused now haha.

I placed the Case inside Event and now it does everything only on second click.

 

My solution works quite well I think 😅, check it out if you want.

 
0 Kudos
Message 7 of 7
(1,749 Views)