LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timeout for message box

Hi,
I found some hints to my problem on the forum, but I haven't quite managed to solve my problem.
At some point of my main prog data are written onto a file. If the file already exists, a message pops up and asks "File exists. Overwrite, Append, Quit?". Then action is taken according to the user's choice.So far so good.
The thing is that I'd like to timeout the message box, that is if the user does not respond within say 5 s then a default value (Append) is passed through.
How can I do this?
I've been struggling with Event Structure but couldn't figure it out.
thanks in advance for suggestions (also for any piece of code),
mirko
0 Kudos
Message 1 of 9
(6,273 Views)

zampala0,

 

The message boxes you are talking about are being shown modally by the functions you are calling.  It would help if you could elaborate on what functions you are using to write data to files?  Most likely, in order to get the functionality you are looking for, you will have to manage the files yourself and possibly create your own file overwrite dialog box vi that has a timeout feature to auto-answer the question.  The best deal would be to have the user specify a target file ahead of time, check for its existence and deal with the overwrite, append question before the file vi does.  Is this software running unattended and therefore needs to auto-answer prompts?

 

-cb

0 Kudos
Message 2 of 9
(6,268 Views)
You don't really need anything special to create a dialog that times out. You can start with the Express Dialog VIs and simply modify them:
  1. On the block diagram, right-click and select the "Dialog and User Interface" palette. Select the "Prompt User" Express Dialog VI and place it on the block diagram. Set up the dialog with your message and the number of buttons you want. Click OK when done.
  2. Right-click on the Express VI that you just placed and select "Open Front Panel". You'll get some question asking whether you want to convert the Express VI into a "regular" VI. Click the "Convert" button. You'll get a spanking new VI.
  3. In the block diagram of this VI all you need to do is add a little timeout feature that simply stops the loop. Something like this:

    You can then have the dialog spit out the result and have your code handle the operation.


Message Edited by smercurio_fc on 01-15-2008 09:02 AM
Message 3 of 9
(6,260 Views)
Thanks to smercurio_fc suggestion I got closer to what I would like to make.
However

1 - can I set 3 or more buttons with the
"Prompt User" Express Dialog VI ? it looks like I can get only two.
2 - I do not need the user to input data of any sort, I just need him to click one of the three buttons (Overwrite, Append, Quit).

I guess I could modify something in the code, but it far beyond my capabilities.

Attached is the code for my dialog box I would like to time out - perhaps not a masterpiece but it gets the job done...

Thanks in advance for further suggestions



0 Kudos
Message 4 of 9
(6,236 Views)
You won't be able to use the built-in dialog functions because they are either modal (such as the one you used), or they have no timeout feature. The modal ones will take over, so you can't be checking for time when they're displayed. Thus, you have to spin your own.

You do not need to specify any inputs for the "Prompt User" Express Dialog VI. If you don't specify any inputs you'll just get a dialog box with a prompy and the buttons.

Once you convert the Express VI to a regular VI you can add as many buttons as you want. The "Prompt User" actually already has 3 buttons. Two of them are used as OK buttons depending on whether the Express VI is set up to display 2 buttons or just one. Thus, all you need to do is change the text inside the buttons and delete the three property nodes that are setting the strings and visibility of the buttons - you don't need any of that stuff.

Attached is an example of the Express VI modified as such. I'll leave it to you to modify it to have it output what you want..

Note: In your VI you were using the STOP primitive. This shouldn't normally be used, as it really stops your whole program from running. It has its uses, but they're rare.
Download All
Message 5 of 9
(6,216 Views)
Thanks a lot for all your input, you rock!

I believe I read somewhere that it is possible to rate a good answer - but can't remember where and how.
If so and if of any good, I'd be glad to rate yours.
Message 6 of 9
(6,194 Views)

For rating others' answers, you should have answered 50 opsts atleast. Smiley Happy

Thats the latest rules...

- Partha ( CLD until Oct 2027 🙂 )
Message 7 of 9
(6,187 Views)
Hey Zampala0,
 
Rated mercurio on your behalf Smiley Very Happy
 
(ps: hope you had a rating of 5 stars in your mind Smiley Tongue )
Message 8 of 9
(6,182 Views)
Hey dev, thanks for it!
yeah, I'd have rated mercurio no less than 5 stars!
Message 9 of 9
(6,174 Views)