02-05-2015 07:40 AM
Hi,
I can't figure out how to implement this:
Top VI (Main.vi):
It has a switch, when it's ON, the serial RS-232 port is communicating with a slave (a simple master-slave half-duplex protocol), in a infinite loop
Then I have 3 buttons that must pop-up a new window each (settings1.vi, settings2.vi, settings3.vi) with other controls (like read/write buttons, numerical and enums).
1) I want to be able to pop up these 3 at my will, so they are not modal, so I am keen to use "start async with call and forget", but
2) I want that closing the panel of the main.vi causes the close of the other windows (if they are open).
I can't rely on abort, I must properly exit, stop and release COM ports and communication.
So basically I need a UI like GIMP, where you have multiple windows, but you close everything by closing the main one.
thanks
02-05-2015 08:22 AM
When I've done this type of thing before I have a way for my main UI to communicate with the floating UIs. You can use queues or dynamic events. That way if the main UI closes just send a close command to the floating UIs.
02-06-2015 10:08 AM
Hi,
Have you tried using invoke nodes to call your settings1.vi, settings2.vi, settings3.vi,? This way you can use buttons to activate case structures and call your subVIs, but you will have to configure them to open the front panel, you can do that directly on the invoke node.
Also you may want to consider using a global variable to control the stop button of your subVIs, that way you can close them and free their resources and ports after the execution.
You can see information about calling VIs using invoke nodes in here: http://digital.ni.com/public.nsf/allkb/4838398F3B2798A186256B82007B4ED0
If you want to know about global variables you can see this link: http://www.ni.com/tutorial/7585/en/