473,378 Members | 1,410 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

function blocking waiting for user interaction

hello.

I'm trying to halt a function's execution while waiting for user
interaction.

For example, I have a function called getUserValue() that pops up a hidden
div containing several buttons. Each button sets a value. I want use a
function to pop the box, wait for the users' button press, and then continue
the function based on what the user presses.

Behold, simi-code:

function getUserValue() {
... lots of code ...
var returnValue = doPopBox();
... lots more code based on users selection in doPopBox();
}

I've written quite a bit of supporting code, but the getUserValue()
continues to execute after the box is popped up, even before the user
presses a button.

I used setTimeout() to check to see if the button has been pressed -- but
when the timer starts, the interface is locked and a button cannot be
pressed. I also tried using a recursive function, (check value=null, if it
is, recheck), but Firefox and IE apparently don't like what may seem like an
unending recursive loop.

Is anyone doing this already in code? Any suggestions?

Thanks!

JMcdugal
Oct 26 '06 #1
2 2003
ext237 wrote:
I'm trying to halt a function's execution while waiting for user
interaction.
Sorry, not possible.
Instead, display what you need to, then when user interaction happens, act
on it.
For example, I have a function called getUserValue() that pops up a
hidden div containing several buttons. Each button sets a value. I
want use a function to pop the box, wait for the users' button press,
and then continue the function based on what the user presses.
Instead, just try to prevent the user from doing anything until they act on
the popup. Do this either using the browser's built-in modal dialog (if
supported) or a simulated modal dialog like:
http://www.javascripttoolbox.com/lib/popup/example.php

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Oct 26 '06 #2

"Matt Kruse" <ne********@mattkruse.comwrote in message
news:eh*********@news2.newsguy.com...
ext237 wrote:
>I'm trying to halt a function's execution while waiting for user
interaction.

Sorry, not possible.
Instead, display what you need to, then when user interaction happens, act
on it.
Yikes. Wanted to do a global find/replace on confirm boxes for our app.
Thanks for the reply.

JM
Oct 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeff Learman | last post by:
I want to do a very simple thing in Windows. (Using Python Shell.) I want to write a prompt to sys.stdout and read the user input. (Ideally, without waiting for a newline.) Here are the...
4
by: Jonathan Fine | last post by:
Hello I have written a program that interacts with a command line program. Roughly speaking, it mimics human interaction. (With more speed and accuracy, less intelligence.) It works fine...
3
by: David Sworder | last post by:
This message was already cross-posted to C# and ADO.NET, but I forgot to post to this "general" group... sorry about that. It just occured to me after my first post that the "general" group readers...
4
by: Christopher H. Laco | last post by:
I'm having a problem with the TcpClient that I can only conclude is either a feature, or a complete misunderstanding of the docs on my part. In a nutshell, I'm simply performing the following...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
7
by: David Sworder | last post by:
Hi, I'm developing an application that will support several thousand simultaneous connections on the server-side. I'm trying to maximize throughput. The client (WinForms) and server communicate...
5
by: pswulius | last post by:
Hey everyone, for reasons I can't explain quickly, I'm developing a completely custom OK/OK_CANCEL dialog, though I think many people would benifit from this knowledge. I basically need to...
3
by: paul | last post by:
HI! I have being to add the following as part of a function but it just will not work as is but I don't know why, can someone point out why. This opens up a popup window for a popup detection...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.