[Chameleon] Window focus

Paul Spencer pagameba at magma.ca
Thu Sep 9 12:07:04 EDT 2004


Scott,

Chameleon does not do this (yet) although I think it would be a decent 
enhancement to the way all popups work in chameleon.

The way to do it is to preserve a handle to the open window.  In the 
code that opens the popup, you should have something like:

wh = window.open( .... );

The code should probably read something like:

//globally defined unique handle
var whMyPopup = null;

function myPopup()
{
     if (whMyPopup != null)
     {
         //raise existing window
         whMyPopup.focus();
     }
     else
     {
         //open new window
         whMyPopup = window.open( ... );
         whMyPopup.onclose = "window.opener.whMyPopup = null;";
     }
}


without some experimentation, I'm not sure if the onclose thing will 
work.  There are other ways to do that, though ...

Cheers,

Paul
Tweedy, Scott wrote:

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

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



More information about the Chameleon mailing list