473,402 Members | 2,064 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,402 software developers and data experts.

Wait until window closed before continuing

I am opening a windows (well, technically a greybox() call GB_show()
which shows a nicer window than normal), and want to wait until that
window is closed before moving to the next command. However, when I
open the window, JavaScript immediately issues the next command
statement. How can I get JavaScript to wait until the window is
closed before continuing? Here's visually what I'm trying to do:

statement1;
GB_show('mycaption, 'http://www.mypage.com');
statement3;

When the window opens, JavaScript immediately executes statement 3.
I'd like:

statement1;
GB_show('mycaption, 'http://www.mypage.com');
wait-until-window-closes;
statement3;

Thanks for your help.

Aug 24 '07 #1
4 11056
Eddie wrote:
I am opening a windows (well, technically a greybox() call GB_show()
What is a greybox(), please?
which shows a nicer window than normal),
Assuming it is still a Window object, do you realize this is probably based
on a browser bug?
and want to wait until that window is closed before moving to the
next command. However, when I open the window, JavaScript immediately
issues the next command statement. How can I get JavaScript to wait
until the window is closed before continuing?
You cannot (ref. FAQ 4.20), but see below.
Here's visually what I'm trying to do:

statement1;
GB_show('mycaption, 'http://www.mypage.com');
BG_show() is not a built-in method. Unless you say what your library is,
better what it actually does, only people experienced with that library can
help you. Given the number of libraries out there, and most of them being
bad, it is unlikely to find such a person here.
statement3;

When the window opens, JavaScript immediately executes statement 3.
I'd like:

statement1;
GB_show('mycaption, 'http://www.mypage.com');
wait-until-window-closes;
statement3;
Modal windows would be a solution, but they are MSHTML-proprietary.

Assuming this is about a Window object, you could check if the window was
closed once in a while:

/**
* @see http://pointedears.de/scripts/types.js
*/
function isMethodType(s)
{
return /\b(function|object)\b/i.test(s);
}

function checkClosed(ms)
{
if (!w || w.closed)
{
if (isMethodType(typeof window.clearTimeout) && window.clearTimeout)
{
window.clearTimeout(t);
}

statement3;
}
else
{
t = window.setTimeout("checkClosed(" + ms + ")", ms);
}
}

statement1;

// retrieve the Window object reference
var w = ...

if (isMethodType(typeof window.setTimeout) && window.setTimeout)
{
var t = window.setTimeout("checkClosed(250)", 250);
}
HTH

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Aug 24 '07 #2
What is a greybox(), please?

Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.
BG_show() is not a built-in method...
Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.

I'll check out your code sample to see if that helps. Thanks.

Aug 24 '07 #3
Eddie meinte:
>What is a greybox(), please?

Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.
Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.
1. Well, it's *not* a window. It's an ordinary div.
2. Thomas' code won't work, since it relies on a *window*.
3. Solution: Change the GB code that returns immediately after opening
the "window" (and attaching a "close"-handler to the close-"button"),
that it doesn't return and instead waits explicitly for the closing click.
4. On the mentioned website they state that there is a greybox group on
google groups. Why not ask there?
I'll check out your code sample to see if that helps. Thanks.
I doubt it will.

Gregor

--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvorträge
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Aug 26 '07 #4
Gregor Kofler wrote:
Eddie meinte:
>>What is a greybox(), please?
Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.

Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.

1. Well, it's *not* a window. It's an ordinary div.
2. Thomas' code won't work, since it relies on a *window*.
It can be modified so that it does not wait for a window to be closed, but
for the `div' element no longer to be displayed.
3. Solution: Change the GB code that returns immediately after opening
the "window" (and attaching a "close"-handler to the close-"button"),
that it doesn't return and instead waits explicitly for the closing click.
That is another possibility. Or GreyBox has means of its own.
4. On the mentioned website they state that there is a greybox group on
google groups. Why not ask there?
In this case I'd rather he asks here instead of getting supposed bad advice
from the people with supposed smattering there.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 26 '07 #5

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

Similar topics

4
by: GTi | last post by:
Hello... I have a page located in a frame. This page contains a form. When the user submit this form I want to popup a "Please Wait" window popup window The post may take some time for the...
4
by: Aaron Fude | last post by:
Hi, I have report that takes about 5-10 seconds to generate depending on the load. I want to show the user a progress bar while it is being generated and when it's done, forward the browser to...
3
by: John Dalberg | last post by:
Hi I have a form that opens a new window for the results. Because the results might take a few seconds due to server processing, I would like to display a message "please wait" in the new...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
4
by: Peter | last post by:
I am using CreateProcessWithLogonW to run an external application, the problem I am having is that the C# program does not wait until the external program finishes running before continuing. The...
2
by: AccessPro | last post by:
Hi, I am creating an image-management database. I want my users to be able to double-click on an image (a preview of what exists in a network subfolder), and for the code to open the image in...
3
by: Neekos | last post by:
I'm programatically opening IE and i need my code to wait until the browser is finished loading before continuing. How do i make it wait? i tried: Do DoEvents Loop Until webBrowser1.Busy =...
2
by: Doug | last post by:
Is there a way to get the VB code that opens a popup to wait until the popup is closed before continuing?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.