A Way to Improve User Experience in Complicated Applications in LabVIEW
LabVIEW 8.x comes with the User Interface Event Handler template by default to process user interface events. But in some complicated applications, there will be so many jobs to do at the same time, and this default template is not enough. For example, in one of my projects, UUT’s power supply monitor and serial communication with UUT is running all the time while some tests are performed. If only with the default template in this case, the user interface will freeze when the application is performing some time-consuming jobs like serial communication or DAQ.
My way to improve user experience in such situation is a combination of state machine and the default user interface event handler. The user interface event handler only gets user events and sends them to the state machine by queue. The state machine does the real jobs which the user events suppose to do. And the state machine and the UI events handler run parallel. A simple demonstration is as following graphic:
There should be more to work if you want to use this structure in your real project development. As with this structure, the buttons and other controls will be working even some time-consuming works are performing at the same time. Buttons are no longer freeze in such situation.
It is not the best solution to this problems, but so far in my projects, it works. And any improvement to this program structure is welcome. And, you can download a demo VI here.
Thanks for the great tip. It would have been even nicer if you had attached a sample VI with the post (saves lazy programmers like me some time coding the stuff themselves).
@Rashid Malik
Thanks for your kind words. Just added a simple VI at the end of this post.
I suggest rather use typedefed cluster with typedefed enum for command and variant for command parametmeters – will be more flexible and editable
@Zbigniew Sobków
Thank you. It’s a great suggestion. I’ll use it in future project!