[mapguide-users] Accessing Fusion commands from parent window

Gordon Luckett gordon.luckett at arrowgeomatics.com
Mon Nov 29 17:16:59 EST 2010


If you have put your fusion layout in a frame or iframe you will have to call fusion with top.myframename.6usion


-----Original message-----
From: Michael Adair madair at dmsolutions.ca
Date: Mon, 29 Nov 2010 09:26:57 -0800
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Accessing Fusion commands from parent window

> In Fusion trunk, in MapguideViewerApi.js , the reference to the Fusion 
> window is coded like so:
> 
> /* locate the Fusion window */
> function GetFusionWindow() {
>      var curWindow = window;
>      while (!curWindow.Fusion) {
>          if (curWindow.parent && curWindow != curWindow.parent) {
>              curWindow = curWindow.parent;
>          } else if(curWindow.opener) {
>              curWindow = curWindow.opener;
>          } else {
>              alert('Could not find Fusion instance');
>              break;
>          }
>      }
>      return curWindow;
> }
> 
> I would try that function to get it
> 
> Mike
> 
> 
> On 25/11/2010 1:55 PM, Wilson Herrera wrote:
> > Good day, everyone.
> >
> > i am designing a map and i need to reach the javascript functionalities in
> > fusion (zoom rectangle, open legend window), from the parent window (that
> > is,  mapguide resides inside an iframe), but i havent been succesful in this
> > implementation.
> >
> > to ilustrate my point, let me show you a piece of the interface.
> >
> > http://yfrog.com/3vschemayhj
> >
> > the area with the number 1, is a div inside the main window
> > the area with the number 2, is an iframe, cointaining a fusion mapguide app.
> >
> > the iframe is defined as follows
> >
> > <iframe id="map" name="map" src="
> > index.html?ApplicationDefinition=Library%3a%2f%2fmer%2fmer.ApplicationDefinition"
> > width="100%" frameborder="0" marginheight="0" marginwidth="0">
> >
> > i try to call the functions inside in this way (and many others i forgot
> > without sucess)
> >
> > 1- var Fusion = window.top.Fusion;   //also tried
> > window.frames['map'].Fusion
> > 2- var map = Fusion.getWidgetById('map');
> >
> > and then use
> >
> > 3- map.showLegend();
> >
> > but i got errors in the first line and i think i am doing this in the wrong
> > way, but my mind has been clouded and cant see what i am missing.
> >
> > im getting somewhat frustrated here and i welcome any help.
> >
> > thank you all,
> >
> > Wilson H.
> >
> > ps: this is the window layout, the same you can see in the first link.
> > http://osgeo-org.1803224.n2.nabble.com/file/n5775258/schema.jpg schema.jpg
> >
> >
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list