11-26-2020 04:41 AM - edited 11-26-2020 05:07 AM
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
11-26-2020 08:17 AM
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.
11-27-2020 06:25 AM
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.
11-27-2020 08:25 AM
@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. 🙂
11-27-2020 08:31 AM
Here's a quick snapshot:
11-27-2020 08:36 AM
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.
11-27-2020 09:18 AM
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.