[mapguide-users] gain access to mapFrame divs for javascript drawing?

Jonathan Manafi jonathan.manafi at cctechnol.com
Mon Jun 30 10:43:52 EDT 2008


I have some javascript that initializes a jsGraphics object when my 
taskPane loads. Currently, it loads in a div within the taskPane. And 
before the page loads, I have a document.onkeydown and 
parent.parent.mapFrame.onkeydown set to a function to capture key 
presses and then do something. I have gotten the taskPane to recognize 
mouse movements and mouse clicks that are within the mapFrame, and 
currently, I use those to draw in the taskPane. I had tried what you 
said already, and I found the map table and inserted my own div. To test 
at first, I had put some text inside to see where(if at all) it would 
show up, and within the 'map' table, it showed up on top of the map. 

However, if I try to access it dynamically, after everything has loaded 
it seems, I cannot. I have something like
<code>
var map;
var divID;
var jg;
.
.
.
function init() {
  map = parent.parent.document.getElementsByTagName('frame')[1];
  divID = map.contentDocument.getElementById("mapSpace");
  jg = new jsGraphics(divID);
}</code>

And when my code gets executed, the taskPane turns to a blank page, and 
firebug throws numerous errors when I mouseover the map. The error it 
seems to be giving me is 'clicked is not defined', which is a global 
variable that has been declared and initialized.

Am I unable to draw in the mapFrame once it has already been loaded?

Also, somewhat unrelated, is IE7 not able to capture mouse movement or 
key presses within the mapFrame from the taskPane? It doesn't seem to 
react the same way as Firefox.

Thanks for any help.


Kenneth Skovhede, GEOGRAF A/S wrote:
> What have you tried to do?
>
> If you look at the "ajaxmappane.templ" you can see how the mapFrame is 
> constructed.
> It is actually a table, so you may want the item "map" (a cell) or the 
> item "mapSpace" (a div).
>
> As long as you taskpane file and the mapframe is served from the same 
> server, there should be no problems.
> Regards, Kenneth Skovhede, GEOGRAF A/S
>   
>
>
> Jonathan Manafi skrev:
>> Has anyone ever tried this or have any suggestions?
>>
>>
>> J Manafi wrote:
>>> Does anyone know how to gain access to divs in the mapFrame from a 
>>> taskPane php file? I am trying to use the jsGraphics library to draw 
>>> on top of the map, but I cannot gain access to any div for drawing. 
>>> I am able to have my mouse movements tracked within the map, but I 
>>> am currently restricted to drawing within the taskPane.
>>>
>>> Has anyone else ever tried this?
>>> ------------------------------------------------------------------------
>>> View this message in context: gain access to mapFrame divs for 
>>> javascript drawing? 
>>> <http://www.nabble.com/gain-access-to-mapFrame-divs-for-javascript-drawing--tp18098792p18098792.html>
>>> Sent from the MapGuide Users mailing list archive 
>>> <http://www.nabble.com/MapGuide-Users-f14845.html> 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
>>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080630/02623e2f/attachment.html


More information about the mapguide-users mailing list