inputbox timeout

Posted on 2004-04-21
Last Modified: 2010-05-18
I saw a thread on timming-out forms, my question is can input box be timmed-out?  It seems to put the rest of the program into a wait state untill it is answered.  If so, how (example please.)  
Question by:tm009
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 22

Accepted Solution

cookre earned 125 total points
ID: 10885120
The best way to do that is with a timer - that way everything runs normally and any window events in your program get handled.  You didn't mention a language, so the general approach is:

In main body:
Start Timer
Put focus in target field

In routine to capture field entry complete (lost focus on target field, validation triggered, enter pressed, etc):
Disable timer
Do what youo want when user entry is completed before timeout
In timer interrupt handler:
Disable timer
Do what you want to do when timeout trips


Expert Comment

ID: 10914997
Hi tm009,

Inputboxes behaves like message boxes and one of their behavior is to freezed the entire program until it is answered. Explanation of this is that when the code handle passes through an input or message box, theres no way to get out on that handle unless you pressed ok or cancel.

If you wish to use inputs that pop-ups like input boxes and need to timmed it out, you can use another form instead of inputboxes to behave as you want it too.

hope this one helps.

Expert Comment

ID: 11096655
Just curious how input box can be timeout by a timer? The author's question is how can the program continue with the other events, when an input box is loaded? or how can the input box be timeout, as the authors concern: ( It seems to put the rest of the program into a wait state untill it is answered) cookre answer is quite far cause he might misinterpreted the question by on how to use a timer. .  I hope I made my self clear. . . Please review the question again. . .


PhoenixRic ;-)
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 22

Expert Comment

ID: 11097640
The purpose of the timer is to take back control after a certain amount of time has expired.  When the timer fires, the program can do as it pleases with the content of the input field and can switch focus as appropriate.

Placing focus in an input field doesn't block anything per se. The program can continue doing as it pleases, as long as it realizes that events can fire at any time (which is why many programmers just let the program idle until some event fires).

Expert Comment

ID: 11104822
Sir cookre,
Yes Sir I understand and thats a good timer control capability, but its not an ordinary input field (as I understood,pls correct me if I'm wrong), its an input box field. . and when trigerred, as the author concerned "( It seems to put the rest of the program into a wait state untill it is answered) " Im very much interested on the idea of on how an input box can be timed out when it is loaded, or specifically, how can a timer control this scenario. Because base on my experiences on this, even if a timer is enabled, its execution will be put into a wait state also when an input box is triggered/loaded. From this time, other events will not be available cause the program execution is paused waiting for a user input and will be operational again, the time user pressed ok or cancel and there's no way to go out on that block of code ( MyInput = Inputbox("Pls enter a value") or waiting state. With this inputbox limitation, I chose to use other means of input interface such as another form or pop-ups style picture boxes.

I may not understood your full idea Sir, and I just want to discuss this cause Im very interested on how to... Cause this one scenario really makes me think a lot. . . And I hope you can educate me with this Sir. Thanks.

PhoenixRic ;-)

P.S. Im not after on any credits, points or the likes. .  Just for the new learning that I can Achieved here. Thanks
LVL 22

Expert Comment

ID: 11106090
You finally got through to me - I was reading 'input box' instead of 'InputBox'.  

It can still be done by using SendMessage() in the timer routine.  I'll see if I can dig up some code.

Author Comment

ID: 11129048
I was actually able to time out the inputbox.  But, that caused another problem.  The Input box will not automatically close.  It now stays open until the time out is reached.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question