LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

user dialog with indicator

Solved!
Go to solution

Hello

 

I am trying to create a user dialog that passes text to the main program and monitors a voltage or control with an indicator.  In the example the dialog is stuck in its while loop and the input voltage / control cannot be altered.  Suggested techniques greatly appreciated ?

 

Thanks

 

Gary

Download All
0 Kudos
Message 1 of 8
(3,618 Views)

You do not understand basic data flow. The subVI which you have in your main vi loop, will halt the execution of the main vi, until the subVI finishes execution.

If you want to program a dialog window which communicates with the main VI, and they run in parallel, then you need to launch the subVI dynamically. You can use a Queue or Dynamic User Events to pass data between the two running VIs.

By the way, you should use a LabVIEW project to organize and handle your VIs...

 

Here you get more info how to do properly what you want with Dynamic User Events:

 

http://www.walkingthewires.com/2015/07/20/something-happened-events-in-labview/

 

http://forums.ni.com/t5/LabVIEW/array-of-asynchronous-reentrant-vi-references/m-p/3243224/highlight/...

0 Kudos
Message 2 of 8
(3,584 Views)

I put together a small example which should do what you want.

So in this example you can see how to use Dynamic Events, very useful things in LabVIEW. Note that, your dialog subVI was set as "modal" window, it means you cannot operate on the main VI window until the subVI front panel is open. I have changed the modal behaviour to floating behaviour in the "Window appearance" settings.

 

edit: If you need to create an executable (EXE) from your project later, then do not forget to include the dynamically called subVI in the build settings ("Always included"):

 

Untitled.png

 

 

0 Kudos
Message 3 of 8
(3,564 Views)

Blokk

 

Thanks for your response, information, and example proj.  This makes a great user interface. 

 

Not quite sure where to start, the structure is over my head at the moment.  I need to study the information in the two links you sent me and see if I can understand.  For now, I have a couple more questions I believe are closely related and might help me.

 

Is the block diagram from your example a standard design pattern for Queue or Dynamic user events ?

 

Can the Master / Slave or Producer / Consumer (non event) techniques be used to achieve similar results ?  Similar results meaning "program a dialog window which communicates with the main VI, and they run in parallel". ?  I am in the process of studying these design patterns through the online training.

 

Thank You

 

 

0 Kudos
Message 4 of 8
(3,502 Views)

@ggress1 wrote:

Blokk

 

Thanks for your response, information, and example proj.  This makes a great user interface. 

 

Not quite sure where to start, the structure is over my head at the moment.  I need to study the information in the two links you sent me and see if I can understand.  For now, I have a couple more questions I believe are closely related and might help me.

Take your time, it is not 5 minutes to learn LabVIEW. The example I showed may look complex, but if you understand how Events work, you will see why they are very useful.

 

Is the block diagram from your example a standard design pattern for Queue or Dynamic user events ?

Neither. Standard design patterns are those shipped with LabVIEW, I just put together a small example. In this example I do not use a Queue (did you find any Queue function in my example?) but Dynamic user events.

 

Can the Master / Slave or Producer / Consumer (non event) techniques be used to achieve similar results ?  Similar results meaning "program a dialog window which communicates with the main VI, and they run in parallel". ?  I am in the process of studying these design patterns through the online training.

It is good if you study these design patterns, it will help you to understand LabVIEW deeper and also practice good design techniques. I agree, it is better if you go step by step. I have attached a modified project example, where you can find two new files (and a typdef control, you will learn why it is a must one to use type definied controls!):

app for user dialog_Queue_version.vi

event dialog_Queue_version.vi

These represent a possible solution, not using Event structures. Still, with Events you can just get more far in LabVIEW! Overall, the final choice should also depend on your whole code. So it depends on the code too where you want to use this functionality which you described.

 

EDIT: the timeout case is not really needed in the subVI, since we poll the subVI via the Queue at every 100 msec, so the Stop button is read. If you stop the main VI while loop before stopping the subVI loop, we send a stop command after the main while loop. So you can just set the Dequeue function to never time out...

 

 

app for user dialog_Queue_version_BD.png

event dialog_Queue_version_BDadas.png

0 Kudos
Message 5 of 8
(3,482 Views)
Solution
Accepted by topic author ggress1

So the subVI could be like below. Actually what is your final goal with this dialog window? You just experiment how to program such parallel pop-up windows, or you want to deploy such functionality in a larger project? If you share us what your code should do, we might give more specific help...

 

Example_VI_BD.png

Message 6 of 8
(3,454 Views)

Perhaps this would be helpful

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(3,428 Views)

For now I am just trying to understand how these parallel pop up windows work.  In the future would like to use this technique to create more dynamic user interfaces.  Some cases require the user to make parameter (temp, press, voltage, etc.) adjustment before the next step in a test sequence can be executed.

 

Thanks again for all the explanation and examples.  Now I need to go to the school of hard knocks for awhile to understand these techniques.

 

 

0 Kudos
Message 8 of 8
(3,353 Views)