pitermann Posted January 26, 2014 Report Share Posted January 26, 2014 hello lavas,I developed the entire application as a standard state machine, which has an "Idle" state with an event structure inside.The event structure captures UI buttons value change events.My aim is to capture ui events *ONLY* when the main state machine is waiting, that's all.In other words, if tasks have been completed and the state machine returns to the idle state, the user is allowed to perform another task by clicking on its button.However, when I start a task, the SM correctly switches from Idle to the correct state (i.e. DAQ INITIALIZE), but if I intentionally push a again a button, the execution freezes up.Since the event structure is not being in execution so far, I'm expecting the button event should be simply ignored. Is it a normal behave of labview?Are there some options in the event structure setup should I check?thnx Quote Link to comment
crossrulz Posted January 26, 2014 Report Share Posted January 26, 2014 You have the event setup to freeze the front panel to until the event completes. This is the default setting. So what happens is if you are not regularly checking for events with the event structure, the panel will freeze once you hit that button. Once the state machine comes back to the idle state, it should call the event structure, react to the event, and go running again. The simple solution to this is to disable and gray out the button. Use a property node to set the Disabled state. Use the "Enable" and the "Disable and Gray Out" options. So after the button is pressed, you disable the button. When you go back to the idle state, you reenable it. Quote Link to comment
pitermann Posted January 26, 2014 Author Report Share Posted January 26, 2014 thanks for your reply. I'm aware of "lock front panel" checkbox on each event case editor, but the program is not affected by this. And it shouldn't, of course. The event structure cases are merely control cases, I've just put inside an enum constant to properly address de main SM. I forgot saying the "time consuming" task is into a SM's state, not into an ES case. Is disabling buttons the only way to keep them out of firing unwanted events? It'll be quite a wire jam to manage buttons gray out. What about saying something like this: "hey... stop listening to events now..." Quote Link to comment
Darin Posted January 27, 2014 Report Share Posted January 27, 2014 Personally I would set the cursor to busy when a time consuming task is running. 1 Quote Link to comment
PaulL Posted January 27, 2014 Report Share Posted January 27, 2014 OK, I think the view and the controller should operate correctly independently of one another. This means the view should enable and disable buttons properly, but it also means the controller should be able to handle any command at any time (discarding inappropriate commands and perhaps returning an exception). The "Idle" state approach is not, in my opinion, the best approach to achieve this. If you do stick to the approach you have chosen, you should be able to use the debugging tools to follow the execution to reveal where the controller is hanging. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.