06-06-2008 04:29 PM
06-06-2008 04:52 PM
06-07-2008 01:58 AM
06-08-2008 11:30 AM
You need to learns the magic of dataflow and simplify your code. It is extremely convoluted.
All you need is a single while loop and a single event structure with all the cases you need (including stop). The case structure is completely useless because the code does not need to change based on tab state. The value change event can only happen on one tab state anyway. You can check it a the "key down" filter event and ignore it if the tab control is on the wrong tab.
Also none of your local variables are needed, just connect the controls and indicators directly to the wires. (You are still stuck in a text programming mode).
06-08-2008 09:40 PM
Here's a quick modification how you could do it quite a bit more streamlined!
(no locals, one event strucuture, one loop, one simple case structure, no timeout case, understandable code).
See if it makes sense. Modify as needed. 🙂
06-09-2008 07:57 AM
Thanks, everybody.
Especially, altenbach, I see how much cleaner your vi is. It didn't occur to me my event handlers could be making the choices my case structure was. My example is a proxy for a more complicated real-life situation, not surprisingly. The rules for exiting activities in my tab control cases are different for the different cases and depend on other variables. I'm rethinking the basic logic of it all. Maybe I can do it all with just event handlers, or maybe do the logic of the user interface with event handlers and do the big work of the system elsewhere, someplace consuming the choices produced by the user interface.
The change from text programming has been slow. While loops and for loops elsewhere are checking and sometimes changing values for what seem like given physical experimental reasons. It seems like this keeps forcing values to involve variables and not just dataflow, but then everything keeps looking more and more like variable-based thinking. Does this mean this particular situation really needs variables, or that I'm getting stuck in non-dataflow thinking? It's not that easy to tell yet.
Also, thanks all for the correction about how events work. There is certainly a way to fix what I originally identified as the problem, IF it still looks like that's the wisest thing to be doing.
This is a lot to think about.