LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a better way to do this pop up?

Solved!
Go to solution

@altenbach wrote:

As a simple solution, all you probably need is a popup subVI that does not contain any loops and returns immediately so the main code does not stall.

 

Set its windows appearance to show the front panel when called, but don't close afterwards. This will make the panel stay open for inspection while the main program continues and you can close it at any time with the [X] in the upper right corner.

 

99% less code and 99% fewer places where bugs can hide! 😄


But how would the pop up update the graph with new data from the main vi if there is not a loop running in the sub?

0 Kudos
Message 11 of 23
(2,601 Views)

@bobausttex wrote:

But how would the pop up update the graph with new data from the main vi if there is not a loop running in the sub?


I did not get this as a requirement from the original discussion. You said that they do not need to return data.

 

If you call it again in the same way while the panel is still open, it will show the new data.

0 Kudos
Message 12 of 23
(2,596 Views)

@Hooovahh wrote:

I'm not sure where you think that personal attacks on your coding skill were taking place but I only see valid criticism in this thread.

 

One thing I saw is that your code is pretty static.  You mentioned if you wanted 4 windows you'd need 4 loops, and that isn't necessarily true.  You could have an array of references that contains all of your floating windows.  Then you could pass data to and from each of them using something like a queue or user event.  Working with controls can work, but gets clunky and I never have a good way to send data back.  User events are usually what I choose so I can have UI events, and request events in the same place, assuming I neither interrupts my state machine for long.

 

Oh one other thing I haven't seen mentioned yet is how cleanup needs to make sure it closes these floating windows, and close references appropriately.


I know I don't need a loop for every window.  There are that many loops running in the program already doing other tasks.  One more loop to deal with the 1 to 5 possible pop ups was waht I was talking about.  

So if I launch the sub from a loop not part of the main data colleciton loop I can use a queue or event to pass data between two running VIs?  I would need to see an exaple of that.  I have read about using them and played some using online toutourials but I felt like that would only work local to the main VI.

0 Kudos
Message 13 of 23
(2,592 Views)

@bobausttex wrote:
So if I launch the sub from a loop not part of the main data collection loop I can use a queue or event to pass data between two running VIs?  I would need to see an exaple of that.  I have read about using them and played some using online toutourials but I felt like that would only work local to the main VI.

I found this image online. It shows calling a VI asynchronously from one loop and then the Wait on Asynchronous Call in another loop. This isn't exactly what you want because you don't need to Wait for the subVI to end in another loop. Instead, replace the Wait on Asynch with your Dequeue Element node. The Asynch subVI can write to that queue and that other loop is sitting there waiting to dequeue. This is like I posted above: if both the subVI and the consumer loop know the queue reference, the subVI can enqueue and the consumer loop can dequeue.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 14 of 23
(2,584 Views)

@altenbach wrote:

@bobausttex wrote:

But how would the pop up update the graph with new data from the main vi if there is not a loop running in the sub?


I did not get this as a requirement from the original discussion. You said that they do not need to return data.

 

If you call it again in the same way while the panel is still open, it will show the new data.


This may be what I am missing.  I will go write a test.  

 

Altenbach, I do appreciate the help.  Sorry I may have taken the comments wrong.  We have most likely met.   I live here in Austin and go to most developer days.  I am 57 and programming is not my job or carreer.  I am just doing my job and that is being sure we can collect data.

0 Kudos
Message 15 of 23
(2,581 Views)

Thanks James,

If I am not wrong that operates just like my examble in that it opens a reference and then pass data to sub using an async call.  I do not need return data.   

0 Kudos
Message 16 of 23
(2,573 Views)

Ah okay, yeah I can't see your example in 2015. If your example is like my image above, then you should be able to simply replace the Wait on Asynch Call with a Dequeue function and get data that way.

 

Altenbach's solution may be simpler if that works for you though. Make sure you have an input boolean to the subVI to tell it whether you want to run the subVI, or just read the outputs from the previous run.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 17 of 23
(2,566 Views)

@bobausttex wrote:

I want a sub window graph to pop up, pass continuous data to it from the main vi and have the pop up not interfere with the operation of the main vi. I am hoping I am trying to do a simple task the hard way with my example.


Does this work for your requirements?  It's a simple call (not async) to update data and an Open FP property node.   Loop in Popup is removed.Poipup.png

Download All
0 Kudos
Message 18 of 23
(2,520 Views)

I have several ideas to try now, thanks.

Part of the reason I am not sure about removeing the loops from pop up is due to the age of the program.  The convention since the 90s when it was on a Unix system was to never close windows with the X and only offer Done or Stop buttons.  That is what everyone is use to.

0 Kudos
Message 19 of 23
(2,474 Views)

There is something to be said about developing code for your target audience, and to use conventions they are used to.  But whenever I get a request like that I explain that going against modern convention means more training for new employees.  Where if modern conventions are used, then software can be made in a way that new users inherently know how to use (and close) it.  

 

It is not uncommon to have new employees be born in the 90s (heck in the 2000's in a few years).  These employees are at an age where the internet has always existed, cell phones have pretty much always existed, and the red X always closes the program.

Message 20 of 23
(2,461 Views)