LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop vi after displaying Message Box?

Hi,
     Can anybody please help me out. I want to stop the vi after displaying message box. I have attached the my application vi along with this. The application requires user to enter the date and time and checks with system date. If user enter data less than present date then apllication will display message box asking user to enter time greater than system time. When user press OK button on dialog box the vi stops running. So my questations are:-
1) Is it possible to stop the vi after message box get displayed(without waiting user to press OK button).
2) If in preasent vi If user select date less than current system date then and press Run Continuously button(instead of run button) the vi goes in infinite loop. To stop the vi I have to open task manager and stop it which is not currect way. How can I handle this condition?
 
 
Thanks  in advance..
 
Mike
0 Kudos
Message 1 of 8
(4,648 Views)

Hi Mike.

The easiest way to avoid using the Task Manager as long as a message box is displayed is: Do not use a message box.

In your case, a string indicator would do fine. The indicator can tell the user about the requirements of the time stamp to specify.
If there is no need to display the indicator, make it invisible.

You can have the "Run Continously button" disappear by customizing the Window Appearance in the VI Properties.

Hope this helps, Guenter

0 Kudos
Message 2 of 8
(4,629 Views)

Hi Guenter,

        Thanks for your valuable input. With this I can remove the continouse run button from the vi and can solve the problem.

        But showing message in string indicator instead of displaying in the message box is something I have not liked. Since this is very small application where I have to display only one message it can work. But as application grows we have to display many such messages so if I have to display them in string indicator then each time I have to erase the string indicator and write new message. Moreover If user is not at his PC for some moment then it can happen that some important messages he may miss. 
            Many such problem can arries. Is this is the only solution to this problem??

Thanks again for the input giveen this help me a lot.

 

Mike 

0 Kudos
Message 3 of 8
(4,620 Views)
Hi Mike,

if you need this more than once you can program your own 'message box'-like vi.
Make it modal to stay on top, and more important: make a timeout input to close the message box after a given time!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(4,614 Views)
Mike,

You can keep a message displayed until the user acknowledges it, but still allow access to other controls on the panel, if you use the indicator Guenter described. Consider the event structure as part of your user interface.

Perhaps you need to carefully define the conditions and actions your program needs. When does a message need to be displayed? What other things need to continue while the message is displayed? How long does the program wait for a response and what should it do if no response is received?

After defining these things, then you can decide on the appropriate implementation. As you have seen, Dialog Boxes may not be suitable if the user or the program itself must take other actions before the Dialog button is pressed.

Lynn
0 Kudos
Message 5 of 8
(4,611 Views)
Hi GerdW,
  Thanks for the sugesstion. The idea looks nice. Can you please tell me how to make vi model and define timout for vi. I have not found any such input for message box. It will be a nice if you have some sample example or link on how to use vi as message box. Please provide me that.
 
 
 
Thanks:-
Mike
0 Kudos
Message 6 of 8
(4,600 Views)

Hi Lynn,

    Thanks for the input given. Suppose I decided that if user has not press OK button on dialog box for some period(let's take 10 sec.) Then we will stop the vi running.  With this I can wait for 10 sec and stop vi so user can see the message box on screen with vi in stop condition.So how can I implement this?

 

Mike

0 Kudos
Message 7 of 8
(4,595 Views)
Mike,

Here is a simple VI which will do that. I did not set it up to be modal. You can do that in VI properties >> Window Appearance.

Lynn
Message 8 of 8
(4,587 Views)