LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is this function after the bundle by name function?

Solved!
Go to solution

Hello!

I found an interesting video about "Spawn Dialogs" (Link https://www.youtube.com/watch?v=L-hNmzQ9tFc)

However, the YouTuber didn't provide the source file.

I tried to realize it by myself but there are some functions I could not figure out.

Does anyone know what is this function ?

RaymondZhao2017_0-1610760747003.png

 

 

I also attached my unfinished version of the program.

Thank you!

0 Kudos
Message 1 of 10
(271 Views)
Solution
Accepted by RaymondZhao2017

Local variables.  No shame in being unfamiliar with those....

 

(This does appear to be a legit use case)

Message 2 of 10
(264 Views)

Thank you!

Interesting, my local variables looks quite different.

RaymondZhao2017_0-1610763101692.png

 

What is the point to put local variables here?

 
0 Kudos
Message 3 of 10
(255 Views)

@RaymondZhao2017 wrote:

Thank you!

Interesting, my local variables looks quite different.

RaymondZhao2017_0-1610763101692.png

 

What is the point to put local variables here?

 

I knew I was dating myself by recognizing those...

 

You use locals here to initialize controls to (possibly non-default) values in your GUI.  As you know, you can't write a value to a control via its terminal, so to give it an initial value for the user you either use a local or a Value property node.  Locals are faster in this case, so that is why I said it is legit to use them here.

Message 4 of 10
(245 Views)

@Darin.K wrote:

@RaymondZhao2017 wrote:

Thank you!

Interesting, my local variables looks quite different.

RaymondZhao2017_0-1610763101692.png

 

What is the point to put local variables here?

 

I knew I was dating myself by recognizing those...


From a quick searching, the local variables got the new look in 2010.  So I am dating myself here as well.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10
(234 Views)

Thank you so much!

Is this the correct way to use this subvi?

RaymondZhao2017_0-1610765424470.png

 

 

Download All
0 Kudos
Message 6 of 10
(232 Views)

@RaymondZhao2017 wrote:

Thank you so much!

Is this the correct way to use this subvi?

RaymondZhao2017_0-1610765424470.png

 

 


I'd quibble over feeding the input through the top of the event structure as opposed to having inputs on the left and outputs on the right (and be sure you feed the values through if you add more event cases).  But the general idea is correct, your SubVI (the popup GUI) can be initialized with the current values and pass on updated ones.

0 Kudos
Message 7 of 10
(221 Views)

@RaymondZhao2017 wrote:

Thank you so much!

Is this the correct way to use this subvi?

RaymondZhao2017_0-1610765424470.png

 

 


That will work.

 

It can be dangerous though.

 

If the event structure gets events that keep coming for a parallel source, the popup will block the execution of these events. So if you have a DAQ loop triggering user events, calling the dialog this way isn't a good idea. The DAQ events will pile up in memory, and won't be executed until you close the dialog (or until you're out of memory). You can get the same effect when you'll add events like mouse move (depending on the event case settings).

 

You'd have to call it either dynamically or in parallel. You'd have to pass the input, and somehow get the result. Tons of ways to do that (queues, passing references, get\set values with VI Server, channel wires, and so on).

Message 8 of 10
(122 Views)

OMG, I never think about that! Thank you for the warning.

But I don't know how to call it dynamically. Or should I simply put it into a parallel while loop? Thank you!

0 Kudos
Message 9 of 10
(99 Views)

@RaymondZhao2017 wrote:

OMG, I never think about that! Thank you for the warning.

But I don't know how to call it dynamically. Or should I simply put it into a parallel while loop? Thank you!


Putting it in a separate loop seems a bit clumsy, but it does avoid a lot of problems. If you'd put for instance an enum with the dialog type in a queue, enqueueing an item would popup a dialog. If all dialogs are mutually exclusive, you're done. The loop can be stopped by closing the queue (the dequeue will get an error).

 

Dynamically calling VIs is a huge topic. You'll run into all kinds of problems. It is very powerful though. Most common problems are executable not working (dynamic Vi not included in the exe), Vi can't be started dynamically (because it's state is not compatible), how to give it it's data, how to get data from it, FP is removed in exe... In general it's a big step to make. But at some point you'll need it.

 

Weirdly enough, the sources I find about VI Server\dynamic VIs are all about Call By Reference. That won't do much good, as CBR stalls execution just like a normal sub VI. A call And Forget would do the trick, and works almost the same. CAF always keeps my VIs in locked state, so I don't use it. I'd use the run method.

 

Another option is to avoid the event structure from receiving events that are blocked of course. That can be difficult if the data has lots of interaction with the UI.

Message 10 of 10
(76 Views)