From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a message box?

I want to know when a particular sub-VI is running when called from another VI. Ideally, I would like a windows-like box to come up, much like a dialog box, that indicates that the sub-VI is running. When execution has completed, I would like to box to disappear, not requiring any additonal user intervention. In Matlab, this is called a waitbar.
0 Kudos
Message 1 of 6
(2,806 Views)
One of the methods I used to create a status bar (similar to what you are describing), is to create a subVI, that is updated from your main VI as needed. I would pass some form of text status and percentage completed information in this subVI.

The VI properties that I used for this subVI is as follows:

1. Dialog Box.
2. Show Front Panel when called.
3. Close afterwards if originally closed.

This way, the user will see the status box at the topmost of your program. It will open the first time it is called and close when you are done with the execution.

I hope that helps.

Shan Pin Koh
0 Kudos
Message 2 of 6
(2,806 Views)
You could use property and invoke nodes to call a dialog vi from the sub when it starts and then close it when done.

I've attached a small example that should hopefully get you started in the right direction.

Brian
0 Kudos
Message 3 of 6
(2,806 Views)
One way that I use is to put the message on the front panel of the sub-VI and then size the panel to include only that area. Then set the properties of the sub-VI (in "Window Appearance->Customize") to include "Show Front Panel when Called" and "Close Afterward if Originally Closed". Simple and effective.
Message 4 of 6
(2,806 Views)
Yes, waitbars are very useful when programs are busy and the user is waiting.

As pointed out by the previous answers, the key is to make use of a dialog. In addition to what have been said by the others, I can provide you with a simple implementation of a Waitbar.

In order for using a bar like this is that you have an idea of how much 100% is (time or iterations). In this simple example I just make use of a counter (in a for-loop) and a 25 ms delay to simulate some sort of activity that takes time. You can use a while-loop if that fits your application better. All you need is a number that goes from 0 to 100 during your process.
I used a horizontal graduated bar to make it look similar to the standard waitbars.

In LabVIEW 6i you can declare any VI as a dialog
by right clicking in the upper right corner of the front panel and select VI settings.


I attach my example, MainWB.vi, that is the main VI and WaitBar.vi that is the subVI declared as a dialog and the actual VI that does the work that takes time.

Hope this helps. /Mikael
Download All
0 Kudos
Message 5 of 6
(2,806 Views)
Just as Rob Cole said,Putting the message on the front panel of the subvi is a simple but effective way.but if you want a really waitbar,perhaps my suggestion can do some helps.
0 Kudos
Message 6 of 6
(2,806 Views)