Solved

inputbox timeout

Posted on 2004-04-21
10
532 Views
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.)  
0
Comment
Question by:tm009
[X]
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
10 Comments
 
LVL 22

Accepted Solution

by:
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

0
 
LVL 3

Expert Comment

by:Phoenixric
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.
0
 
LVL 3

Expert Comment

by:Phoenixric
ID: 11096655
Hi,
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. . .

Thanks.

PhoenixRic ;-)
0
Technology Partners: 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!

 
LVL 22

Expert Comment

by:cookre
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).
0
 
LVL 3

Expert Comment

by:Phoenixric
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
0
 
LVL 22

Expert Comment

by:cookre
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.
0
 

Author Comment

by:tm009
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.
0

Featured Post

Technology Partners: 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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

751 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