> I tried what I just described and... > it almost worked ! It's just that this way, you can't update the > toplevel menu, since its reference would have to be shared between the > two loops, and this doesn't seem to work (remember the change in LV 7, > that forced to use shift registers for menu refnum ?). > I am still stuck with my hidden control to get an event recognized > within the main loop...
I'm coming in late here, but hopefully I can clear the fog a bit. Queues and user events can be used pretty much interchangeable. If you already have a UI structure, the user events may be better, otherwise the queues might be a bit simpler. Notice that I called them user events. Dynamic events is a different feature on event structures and have their own row in the event palette. Note that queues let you use the name to retrieve the refnum from multiple locations. While this is convenient, it can also lead to race conditions when your aren't sure of the lifetime of your queues, and in general, you probably want to pass your refnum through the connector, or make your own little name->refnum function. The first caller allocates, stores, and returns the refnum, and subsequent calls return the refnum already associated with the name. Of course you will want to clear the name->refnum lookup either early in the app run, at the end, or when the queues are no longer valid. As for the menu refnum change in 7.0. If I understand what you are getting at, the issue is really with For loops that ran zero iterations. The behavior of those loops has always been ill defined, and was tightened up a bit. The older behavior would usually work with right hand tunnels wired to left hand tunnels, but wouldn't work if something in the loop modified the value and broke inplaceness. The shift register is a better way to do this since with the exception of constants, LV will now return the default value with for loops run zero iterations. Anyway, as mentioned above, pass the refnum wherever you need it via wire or through a name lookup VI. Just be organized about how this gets torn down and released. Greg McKaskle
