08-06-2015 01:11 PM
I am trying to build a multi-window application. My goal is to be able to have multiple floating windows open simultaneously, which all allow user input.
My problem is, when I open a new floating window, I can no longer click buttons in the other windows.
I've attached a simple example of what I'm trying to do. The Main.vi has two parallel loops and two event structures. One loop has the sole purpose of running the Sub.vi after a button is clicked. The other loop performs some functions when the other buttons are clicked. Since these loops run in parallel, I would think that I can interact with both VI's when the front panels are open.
What am I missing here?
Any help is appreciated. Thanks.
Solved! Go to Solution.
08-06-2015 01:34 PM - edited 08-06-2015 01:45 PM
08-06-2015 01:39 PM - edited 08-06-2015 01:47 PM
Your bottom loop stops because you have a regular call to the subVI.
The event loop cannot finish until the subVI finishes.
To strictly answer your question, Take a look at the options for the EVENT structure. By default the LOCK OUT KEYBOARD UNTIL THIS EVENT IS FINISHED is set ON.
That means just what it says. When you call that subVI, the event locks out the keyboard/mouse on the calling (MAIN) VI.
Having TWO event structures in one VI is asking for trouble.
I have an app with 10-12 windows, all of which are overlappable, and usable.
the way you do it is to run all 10 VIs at startup, but keep them closed.
Send each one an EVENT from the main VI when you want it to open. All they do in response to that event is FP.OPEN.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-06-2015 01:49 PM
My goal is to be able to have multiple floating windows open
Why do they need to be floating? Do you need to hide them when your app goes background?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-06-2015 01:49 PM
There is an option in every event case that is set to TRUE by default: Defer Front Panel Updates Until Event Case Completes. What does this mean? When you click the button to open the subVI, that event case cannot complete until that VI is done running. Since the event case is not complete, your main front panel is actually locked (unable to do the updates).
In general, you really should only have 1 event structure in a VI. What you should do here is use the Start Asynchronous Call to run an instance of your subVI without disrupting your main VI's flow (it will truely run parallel to the rest of your code).
And you really should put the latched buttons in the event case that handles their respective value change event. It will allow the latch back to happen.
08-06-2015 02:16 PM
Thank you for the replies. I figured there was a setting somewhere that I overlooked.
I only used two event structures as an example to try and force the desired behavior.
And in response to your asking why I said "multiple floating windows", what I meant was non-modal.
08-07-2015 03:22 AM
Maybe you should try using Actor Framework to achieve multiple floating windows in your application? Actor Framework enables you to treat each window as separate object, with references for main application to operate on windows. It makes creating multi-windowed application in LabVIEW more similar to creating such application in languages like c, c#, c++ etc.
https://decibel.ni.com/content/blogs/Labvolution/2014/07/23/labview-actor-framework-basics