[mapguide-users] DigitizePoint from a new browser window

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Sep 14 03:00:24 EDT 2009


Try using firebug and set a breakpoint, you can then examine the 
variables, and see what they are.

For this example your code resides in the current page, so I don't 
understand why you call opener.mapFrame to activate the function.
Next up, when you call parent.parent.mapFrame, you do so from another 
window, and thus parent is either null or self.

For this reason, there exists a function called GetMapFrame() which you 
can call from many places.
By using this function everywhere you can simply put in your own 
function in the page, and everything works as expected.
The function would look like this I think:
function GetMapFrame()
{
    return opener.GetMapFrame();
}

Regards, Kenneth Skovhede, GEOGRAF A/S



Peter Scigalla skrev:
> Hello,
>
> my task: I'am trying to pickup a point coordinate when the user clics 
> on the map to center the map on this point with a new scale.
>
> It runs fine when I do this from the task pane. Here a code snippet:
>
> ############
> ....
>    <script  language="javascript" type="text/javascript">
>      function DigitizePoint(m) {
>          if (m==8888) {
>          var ttt= 1 + 1;
>                  ttt = prompt("Geben Sie den Maßstab ein", 5000);
>          abc = ttt-0;
>          }
>          else
>          {
>          abc=m;
>          }
>          parent.parent.mapFrame.DigitizePoint(OnPointDigitized, abc);
>      }
>
>      function OnPointDigitized(point, m) {
>          var x, y, m, parameter;
>          x = point.X;
>          y = point.Y;
>          parent.parent.mapFrame.ZoomToView(x, y, abc, true);
>      }
>      </script>
> </head>
>
> <body>
> ....
>
> <br><hr><p></p>
> <input type="button" value=" 1:500 " onclick="DigitizePoint(500);">
> <br>
> <input type="button" value=" Freier Zoom " 
> onclick="DigitizePoint(8888);">
> <br><hr>
> </body>
> ........
> ############
>
> But how to call the DigitizePoint function from a new window???
>
> I have tried it with
>
> opener.mapFrame.DigitizePoint(OnPointDigitized, abc);
>
> and a lot of other versions, but all failed.
>
> I Know, it's a simple HTML/JavaScript question, but I hope anyway for 
> some advise.
>
> Thanks in advance!
>
> Best regards - Peter
>
> My configuration:
>
> MGOS 2.0.2
> Apache & PHP
> simple WebLayout with AJAX Viewer
> _______________________________________________
> 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