Solved

inputbox timeout

Posted on 2004-04-21
10
485 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 61
for loop with Set 4 46
python question 5 60
Recommendation vb6 to vb.net or others 14 44
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now