[Chameleon] Close popups when main window closes
Berend Veldkamp
berend.veldkamp at aris.nl
Tue Dec 13 10:53:41 EST 2005
Bart,
Thanks for the link.
I just found out my solution might not be very convenient after all:
Popups are also closed after a page refresh, i.e. when zooming in. This
may not be desirable. I think this is going to be a problem for a future
popup manager as well. Unless a separate Close button is added to the
application.
Berend
Bart van den Eijnden wrote:
> Hi Berend,
>
> I think this would be a nice addition.
>
> I can't answer your questions, but I just wanted to point you to a related bug discussion:
>
> http://bugzilla.maptools.org/show_bug.cgi?id=171
>
> Best regards,
> Bart
>
> Bart van den Eijnden
> Syncera IT Solutions
> Postbus 270
> 2600 AG DELFT
>
> tel.nr.: 015-7512436
> email: BEN at Syncera-ITSolutions.nl
>
>
>>>>Berend Veldkamp <berend.veldkamp at aris.nl> 12/13/2005 4:10:04 PM >>>
>
> Hi,
>
> I'd like to close any popup when I close the main application window, so
> I changed CWCPopup->DrawPublish() to include the following Javascript:
>
> var wh = window.open('{$url}', '{$name}', '{$options}');
> if (!wh)
> {
> alert( 'unable to open popup dialog. Perhaps you have a popup
> blocker installed?' );
> }
> else
> {
> if (window.opera) // Opera
> window.opera.addEventListener("BeforeEvent.unload",
> function(){wh.close()}, false);
> else if (window.addEventListener) // W3 DOM
> window.addEventListener("unload", function(){wh.close()}, false);
> else if (window.attachEvent) // IE
> window.attachEvent("onunload", function(){wh.close()});
> wh.focus();
> }
>
> This works for IE and W3 DOM compliant browsers, but not Opera, can
> anyone tell me what I do wrong?
>
> And another thing: With this approach, the Javascript code is duplicated
> for each popup that I use, is it possible to include this only once, as
> a separate function?
>
> If I get this working, would it be possible to include this in the main
> Chameleon distribution, so I don't have to change my own application
> after an upgrade?
>
> Thanks, Berend
>
>
--
____________________________
Berend Veldkamp - ARIS
http://www.aris.nl/
____________________________
More information about the Chameleon
mailing list