[mapguide-users] RE: Problem with ZoomToView during onload event

Jon Rizzo jrizzo at Langan.com
Wed May 30 16:06:22 EDT 2007



setInterval looks like a great solution.  Thank you both for your help.

Jon



Andy Morsell wrote:
> 
> Wow, Kori, you read my mind! 
> 
> 
> Andy 
> 
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kori Maleski
> Sent: Tuesday, May 29, 2007 12:04 PM
> To: 'MapGuide Users Mail List'
> Subject: RE: [mapguide-users] Problem with ZoomToView during onload event
> 
> Something like this:
> 
> 
> var initTimer;
> var viewer;
> function InitDocument()
> {
>     //wait for map to be fully initialized
>     //then call the initial function 
>     initTimer = setInterval(DelayedInit, 200); }
> 
> function DelayedInit() {
>     try {
>        viewer = GetMapFrame().mapFrame;
>        if(viewer.mapInit) {
>            //map has been initialized
>            clearInterval(initTimer);
>            
> 		//Peform your Zoom
>             GetMapFrame().ZoomToView(X, Y, Scale * 2 , true);
>            
>        }
>    }
>     catch(e) {}
> }
> 
> 
> ________________________________
> 
> 
> 
> 
> Kori Maleski
> Senior Application Developer
> WEBSOFT DEVELOPERS, INC.
> P: (530) 759-8754 ext 114
> F: (530) 759-0923
> kori.maleski at websoftdev.com
> ________________________________
> 
>  
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Andy Morsell
> Sent: Tuesday, May 29, 2007 11:24 AM
> To: 'MapGuide Users Mail List'
> Subject: RE: [mapguide-users] Problem with ZoomToView during onload event
> 
> It does sound like the mapFrame where ZoomToView resides does not exist
> yet
> when the onload event from the other frame is calling it.  It may help to
> have onload call in intermediate function in that frame.  That function
> would use a JavaScript setTimeout method or similar to test for the
> existance of the other page.  Once it exists, then go ahead and let your
> ZoomToView execute.
> 
> 
> Andy
> 
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jon Rizzo
> Sent: Tuesday, May 29, 2007 10:29 AM
> To: mapguide-users at lists.osgeo.org
> Subject: [mapguide-users] Problem with ZoomToView during onload event
> 
> 
> 
> I am having a strange problem - I am trying to call the ZoomToView
> function
> in the onload event of my page.  The problem seems to be that sometimes
> the
> ZoomToView function works and sometimes it doesn't.  If I bring up a brand
> new browser session and type in the URL to my page, it usually works fine
> the first time.  If I hit the Reload button, the ZoomToView function
> doesn't
> ever seem to execute (although sometimes it does).  I was reading an
> earlier
> thread which suggested calling the onload event in the top level frame
> (which I have done) but the results are still very inconsistent.  Any
> ideas
> about what is going on here?
> 
> Jon
> 
> --
> View this message in context:
> http://www.nabble.com/Problem-with-ZoomToView-during-onload-event-tf3835370s
> 16610.html#a10858737
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-ZoomToView-during-onload-event-tf3835370s16610.html#a10881616
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list