LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a dialog window with no button that opens along with the main window?

When the main window is open, the dialog window opens up immediately and can be closed by key press. At other times, when the next step, ie: decision, comes to, the another dialog window pops up again and is again closed by key press. Does anyone know how to do? Use the sub-Vi? notification method? occurrence method?

And another thing: how to create a reusable dialog window with no button so that different messages can be sent to it and it can closed by key press. And how to pass the string to the title of the dialog window programmatically?
0 Kudos
Message 1 of 12
(4,548 Views)
Create a subVI with a text box control that fills the entire window and create a connector for it. Set the window appearance to dialog. The diagram should contain only an event structure that monitors key presses and mouse clicks.

In the main program, set the subVI node setup as "show front panel when called" and "close afterwards ...".

Then just call the subVI with the desired text wired into it. Any click or key press on the dialog will close it.

The attached example shows a simple version. Just run it, change the text if desired, then press the button to launch the dialog with the entered text.
Message 2 of 12
(4,548 Views)
I dont think you can heavily modify the dialog boxes that come with LV. A good option would be to create a vi yourself and make it have the appearance of a dialog box (using the appearance properties).
You can use the "wait for front panel activity" vi or a event structure to check if a user has pressed a key.
If you do make a subvi, you can easily reuse it and change the message by adding a string input.

To pass a string to the title, use a VI reference property node and select the 'Front Panel Window -> Title' to change it.

Hope this helps.
0 Kudos
Message 3 of 12
(4,352 Views)
Hi Thanks for your help. There's a problem with nobuttondialog.vi. There's nothing in the key down section of the event structure and it won't run properly. Can you tell where to wire to inside the key down section?

Thanks again
0 Kudos
Message 4 of 12
(4,548 Views)
For your functionality (If I understand it right), nothing needs to be in the event structure. Pressing any key just triggers the event, thus finishing the VI (there is no while loop).

Could you tell me what you mean my "it won't run properly"? Make sure that the front panel of the subVI is closed before starting the main VI. Remember that the subVI is set to "open when called" and "close afterwards if originally closed". So, if you had the panel open already, it won't of course close when finished!

(Actually, the problems is worse when you have the subVI panel open when starting the main VI. you get a catch22 and labVIEW locks up because (1) the subVI is set to dialog and grabs all attention but (2) it has not been
called, thus the event cannot be triggered. So don't do that!!!! As a quick workaround, add the modification shown in the attached image to ensure the panel of the subVI is closed.)
0 Kudos
Message 5 of 12
(4,548 Views)
Hi. Thanks for your reply and help again.
Before I could run your program with the sub-vi closed, I could see that there is a broken arrow already there.

I found that that error leads to the event function in the sub-vi. The error stated that there must be a unwired or bad terminal in the event structure.

I think the event structure misses something that tells its own VI to close by itself.

And there I attached your programs for you to check it out.

I am running Labview 7 evaluation.

Thanks in advance.

Clement Yap
0 Kudos
Message 6 of 12
(4,548 Views)
Ive modified altenbach's code to how (i hope) it should work.
0 Kudos
Message 7 of 12
(4,548 Views)
Sorry, you are right. There must be a bug with converting 6.1 to 7.0. Converting the 6.1 to 7.1 (which I tested!) works just fine. Weird.

To fix it, go to the key-down event, and click on the black "CtlRef" terminal (This is the one that is not available in 7.0, breaking the VI). Select any of the valid choices, e.g. "source" and voila it's fixed! 🙂

I have attached a fixed version. I have also removed the filtering action for these events, because it is not needed here (LabVIEW 6.1 only had filtering action for this).
0 Kudos
Message 8 of 12
(4,548 Views)
Hi Thanks.

There's another corrected by Altenbach.
No need to do anything except configure the event case for keypress. Just an error by version number.

Clement.
0 Kudos
Message 9 of 12
(4,548 Views)
Hi,
Use this subvi that different messages can be sent to it and it can closed by key press or mouse click.
Message 10 of 12
(4,352 Views)