[mapguide-users] fusion and javascript

Paul Spencer pagameba at gmail.com
Wed Aug 20 12:36:07 EDT 2008


I'm not using the viewer api thing but I can confirm that having a  
comma after the last thing in an object declaration or array is not  
valid for IE (but firefox silently ignores it).

Not sure about the var Fusion thing, but that seems reasonable since  
the task pane runs inside an iframe which is a separate document and  
doesn't automatically have references to its containing page variable  
namespace.

It has just occurred to me that this might work better if you don't  
include the MapGuideViewerAPI.js in your task page but rather include  
it in your main index page and then reference its functions through  
window.top ???  Then you wouldn't need to include the javascript files  
in your task page - i.e. use window.top.DigitizePoint()

Cheers

Paul

On 20-Aug-08, at 12:27 PM, Mark Pendergraft wrote:

> I have answered some of my own questions here.
>
> Lines 253 and 321 in MapGuideViewerApi.js were continually breaking  
> my code.  They were curly braces followed by a comma as part of the  
> LineHandlers and RectangleHandlers classes  "},".  Both of those  
> lines are the closing braces for the last functions in the class,  
> and once I removed the commas following the two curly braces  
> mentioned, everything compiled.
> Also, I had to add a reference to fusion "var Fusion =  
> window.top.Fusion" to the file.
>
> I also have to reference a bunch of stuff to use the functions.  In  
> order to use the DigitizePoint() function I had to reference:
> Fusion.js
> Map.js
> Prototype.js
> CanvasTool.js
>
> And of course MapGuideViewerApi.js
>
>
> Is anyone else having these problems calling MapGuideViewerApi  
> functions in their application, or am I just doing something wrong?
>
> -Mark P.
>
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org 
> ] On Behalf Of Mark Pendergraft
> Sent: Monday, August 18, 2008 3:59 PM
> To: mapguide-users at lists.osgeo.org
> Subject: [mapguide-users] fusion and javascript
>
> Hello All,
> I’m having a lot of trouble with Fusion and javascript.  I am  
> somewhat of a newb to fusion, so please bare with me.
> I have a aspx page in the task pane which I have been adding some  
> buttons with some javascript too, in order to test things out.
> At this point, it appears that any call to a function defined in  
> MapGuide.js (../fusion/mapguide/mapguide.js) won’t break my code.   
> For example  
> “parent 
> .document.getElementById('Map').widget.aMaps[0].drawMap();” would  
> refresh the map.
> However, any calls to MapGuideViewerApi.js will not work.
> I have tried including it into my page, and I have also tried  
> calling it in different fashion.
> For example:
> var Fusion = window.top.Fusion;
> var map = Fusion.getWidgetById('Map');
> map.Refresh();
>
> Why won’t the MapGuideViewerApi.js functions work?  If they can’t  
> be used, how do i zoom and digitize points?
> Also, I mentioned that the mapguide.js functions work, yet  
> setSelection does not.
> I get the following error
>
> Fusion Error:
> WARNING: Exception occurred in AJAX callback.
> [object Error]
> Location: {1} ({2})
> xx)
>
> At this point, the functions I need to work in order for my code to  
> function are:
> setSelection
> digitizePoint
> digitizeRectangle
>
> None of which work  
> Any help or a push in the right direction would be greatly  
> appreciated.
>
> Setup:
> MGOS 2.0.1
> Fusion 1.0.6
> Autodesk MapGuide Studio 2009
> Using IIS, VB, and VS 2005 Pro
> _______________________________________________
> 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