LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Outsourcing front panel controls to a floating SubVI front panel

Solved!
Go to solution

Hi!

 

I have already found some similar topics but I am still not sure which is the best way to solve my problem. I will try to describe my problem in details first: I have a main VI which acquires data from a device and displays that data inside a big waveform graph. I also have some front panel controls to control my device. First I had placed all these device controls (numeric, sliders, etc.) together with the graph inside my main VI's front panel. However, due to screen space limitations now I would like to make the graph as big as possible and therefore decided to "outsource" some controls from the main VI front panel to multiple SubVI front panels.

 

I would then push a single button in my main VI and this would open the floating front panel of the corresponding SubVI containing the outsourced controls when required. However everything should be absolutely transparent. It is important that the floating front panels run in parallel with my main VI, i.e. the main VI must continue to run. This way I will have my data constantly refreshed in the graph of my main VI while I can change some device parameters through the controls placed in my SubVIs. These changes shall be then immediately applied (e.g. as soon as the main VI calls that SubVI in its main continuous loop).

 

It is important to make the visibility of the outsourced controls panel optional, i.e. if the SubVI front panel is opened by the user it will pop up and the user will be able to change the device paramers through the controls. But then the user must be able to close (hide) the SubVI front panel in order to see the whole graph again without the floating panel in front of it (of course the set control values must be kept when the SubVI front panel is not visible). And then the user again pushes the button in the main VI that opens the SubVI non-modal dialog containing the controls and he can again set new device values.

 

Any hints how to do this are welcome. I am not sure if I need something complex like VI server or asynchronous VIs or can I solve my problem by changing some simple SubVI settings? Thanks in advance for your help!

 

Best regards,

Anguel

0 Kudos
Message 1 of 15
(4,344 Views)

The fastest approach (as your VI seems to be working right now) is to use a tab control and place e.g. controls and graphs on individual pages.  That way you do not have to deal with passing data from one VI to another.  Is this an option for you?

0 Kudos
Message 2 of 15
(4,340 Views)

@GuenterMueller wrote:

The fastest approach (as your VI seems to be working right now) is to use a tab control and place e.g. controls and graphs on individual pages.  That way you do not have to deal with passing data from one VI to another.  Is this an option for you?


Thanks for the fast reply. Unfortunately this is not a good option, as I want to have the dialog SubVI above of the main VI. The purpose is to be able to change some device settings and immediately see the results in the graph that would be still visible below. I would also put the controls in dialogs which are not very big, this way the user may move the dialog a bit to one side of the screen and still be able see the signal in the graph below.

 

I am ready to restructure my app if required. Passing data from the SubVI containing the controls to the main VI should not be a big problem. Is it possible to just keep such a floating dialog SubVI in the data flow of the main VI?

0 Kudos
Message 3 of 15
(4,336 Views)

AStankov wrote:

... Passing data from the SubVI containing the controls to the main VI should not be a big problem. Is it possible to just keep such a floating dialog SubVI in the data flow of the main VI?


The usual data flow will not work as at least two VIs run side by side.  Queues and/or Notifiers should be used to communicate between these VIs.

0 Kudos
Message 4 of 15
(4,328 Views)

Another option might be VI Box XControls - SAPHIR.

0 Kudos
Message 5 of 15
(4,326 Views)

@GuenterMueller wrote:

The usual data flow will not work as at least two VIs run side by side.  Queues and/or Notifiers should be used to communicate between these VIs.


I see, so I would probably have to let the SubVIs send updated values from the controls to the main VI through a queue. How about asynchronous VIs? I read that these can be launched independently and then data can be collected at a certain point if I remember correctly.

I just wonder if there is no option to just keep the SubVIs in the data flow as before and just set their front panels to visible or invisible. This way I would be able to change the controls if the panel is currently open but the new values would be only read as soon as the main VI calls the SubVI. But this is probably not possible...

0 Kudos
Message 6 of 15
(4,320 Views)

AStankov wrote:

I just wonder if there is no option to just keep the SubVIs in the data flow as before and just set their front panels to visible or invisible. This way I would be able to change the controls if the panel is currently open but the new values would be only read as soon as the main VI calls the SubVI. But this is probably not possible...


Sorry for me not understanding what you mean (or how you have accomplished it in your code) even though I re-read your 1st post.   If the controls reside in a subVI that you call from the mainVI you can open the subVI's FP and keep it open to operate on the controls. Sending any Value Change events from the subVI to the mainVI requires a communication channel to the mainVI - like a queue.

Another option would be to finish the subVI on each value change and the changed values can be wired from the subVIs connector pane in the mainVI.

0 Kudos
Message 7 of 15
(4,304 Views)

@GuenterMueller wrote:
Sorry for me not understanding what you mean (or how you have accomplished it in your code) even though I re-read your 1st post.   If the controls reside in a subVI that you call from the mainVI you can open the subVI's FP and keep it open to operate on the controls. Sending any Value Change events from the subVI to the mainVI requires a communication channel to the mainVI - like a queue.

Another option would be to finish the subVI on each value change and the changed values can be wired from the subVIs connector pane in the mainVI.


Sorry, I probably did not explain it well. So far I still have my controls in my main VI on its front panel and have not moved them to SubVIs.

How about using a global variable for VI to VI communication instead of a queue?

Would the last option you mentioned, i.e. finishing the SubVI on each value change, allow me to keep the SubVI front panel open as required until the user choses to hide it? Or would there be any unavoidable flickering of the panel or any other drawbacks?

Thank you for the help GuenterMueller!

0 Kudos
Message 8 of 15
(4,281 Views)
Solution
Accepted by topic author AStankov

AStankov wrote:

How about using a global variable for VI to VI communication instead of a queue?


A global variable will do, too.  You will write to it at one location and read the value frequently at another location (polling). Thus you will easily see any value change.  However, polling will waste a good amount of CPU time.  For that reason I proposed to use a queue or a notifier.

 


AStankov wrote:

Would the last option you mentioned, i.e. finishing the SubVI on each value change, allow me to keep the SubVI front panel open as required until the user choses to hide it? Or would there be any unavoidable flickering of the panel or any other drawbacks?


Yes, the subVI can keep the front panel open until the user closes it. And there should be no flickering.  The most important drawback I see right now is, that when waiting for an event in the subVI, the mainVI cannot stop without telling the subVI to stop.  So you will need another communication channel (again a global, a queue, a notifier or an event) to tell the subVI that it should stop.

Message 9 of 15
(4,270 Views)

Thank you once again for the help Guenter.

0 Kudos
Message 10 of 15
(4,261 Views)