[Chameleon] RE: Window focus

Paul Spencer pagameba at magma.ca
Fri Sep 10 15:03:01 EDT 2004


In response to Bart as well ...

AFAIK there is no way to preserve a window handle across page submits.

Oddly, though, references like 'window.opener' in the popup do work 
after the opener has refreshed.  The following approach seems like it 
may work ...

---- in the popup window ----

function checkHandle()
{
     if (opener.myWH == null)
     {
        opener.myWH = window;
     }
     setTimeout( 'checkHandle()', 1000 );
}

---- in the main window ----

var myWH = null;



You can make this more sophisticated by attaching to the onunload event 
of the main window and only starting timeouts when the page unloads, 
plus in the popup, check to see if the page has finished loading then 
set the handle and stop the timeouts.

If you want to try this, it may work.  If you are willing to let us know 
what you were able to get working, I would be interested in modifying 
the Popup architecture in Chameleon to implement something like this ...

Cheers,

Paul

Ken Sanderson wrote:

> If you are building the page on the fly you could add your variable to
> the child window at the same time, or you could pass your variable
> through the URL used in the open(). If not building the page on the fly
> I think if you have a variable defined on the child, you can then assign
> data to that variable. So you would do the open() and then assign data
> to the specific variable.
> 
> Some thoughts at any rate.
> 
> Ken
> 
> -----Original Message-----
> From: chameleon-bounces at lists.maptools.org
> [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Tweedy, Scott
> Sent: September 10, 2004 7:44 AM
> To: 'chameleon at lists.maptools.org'
> Subject: [Chameleon] RE: Window focus
> 
> 
> Thanks to Paul and Jason for your answers they work.  Now I have another
> question.
> 
> It seems that the window I open is tied to the main window (that's where
> I had to declare the variable myWh to make this work).  Once any
> operation is performed on the map (Zoom in, Apply points to map, etc)
> and the main page refreshes I lose the variable myWh and the application
> window starts again.
> 
> Is there any way around this behaviour?  Is there any way of passing the
> variable myWh (the child window) in a form to the newly refreshed page?
> 
> Thanks again,
> st
> 
> 
>> -----Original Message-----
>>From: 	Tweedy, Scott  
>>Sent:	Thursday, September 09, 2004 10:56 AM
>>To:	'chameleon at lists.maptools.org'
>>Subject:	Window focus
>>
>>I have an application written in Chameleon.  When a button in the main
> 
> 
>>application is clicked it opens a child popup window which contains 
>>most of the code for the application.  If the user  minimizes the 
>>child window and clicks on the main button again the child window is 
>>reinitialized and the user has to start from scratch.
>>
>>Is there a way to test to see if the child window is already open when
> 
> 
>>the user clicks on the main button and to simply shift focus to that 
>>window if it is and to reinitialize it if the window isn't open?
>>
>>Thanks in advance,
>>st
>>
>>Scott Tweedy
>>Geoscience Database Analyst - Analyste de base des données 
>>géoscientifiques ESS Geoinformatics Division - Division SST 
>>Géoinformatique Earth Sciences Sector - Secteur des sciences de la 
>>terre Natural Resources Canada - Ressources naturelles Canada
>>580-615 Booth Street - 580-615 rue Booth
>>Ottawa, ON  Canada  K1A 0E9
>>tel. (613) 947-0665 - tél. (613) 947-0665
>>fax (613) 995-2520 - télc. (613) 995-2520
>>Email sctweedy at nrcan.gc.ca - Courriel sctweedy at nrcan.gc.ca
>>
>>
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



More information about the Chameleon mailing list