Re[mapguide-users] cursive digitizePoint

BruceWeston ross at ime.co.uk
Mon Mar 10 07:20:31 EDT 2008


Hi folks,

I have a small problem with the DigitizePoint function which seems a bit
odd. I have a map and I want to record the XYs every time the map is
clicked, without having to press a button first. My initial thought is to
digitizePoint on the page load and then in my callback handler,
digitisePoint again so there is recursion. This is the only function that
will be happening on this map. Here is my Javascript:

<script language="javascript" type="text/javascript">
        var viewerFrameSet;
        if(parent.document.getElementById('viewerFrame').contentDocument){
            //This is for firefox
            viewerFrameSet =
parent.document.getElementById('viewerFrame').contentWindow.document.defaultView.parent.frames[0];
        }else{
            //This is for IE
            viewerFrameSet = parent.viewerFrame;
        }
        
        function digitisePoint(){
            alert('Now pick a point on the map');
            //Put it into select mode, then digitise point mode
            viewerFrameSet.mapFrame.ClearSelection();
            viewerFrameSet.ExecuteMapAction(15);
            viewerFrameSet.mapFrame.DigitizePoint(OnPointDigitized); 
        }
        
        function OnPointDigitized(point) {
            document.getElementById("resultArea").value = "X:" + point.X +
"\nY:" + point.Y;
            digitisePoint();
        }
    </script>

ResultArea is a textbox.
viewerFrameSet is a variable I use to set the location of the functions.

It works the first time, but then never after that until I click the button
that runs digitisePoint. Any ideas why OnPointDigitized only runs once? The
recursion part actually works but the second time it goes into
digitisePoint()  it doesn't do the OnPointDigitized bit.

I hope this makes sense to people - it's becoming quite confusing.....

Ross
-- 
View this message in context: http://www.nabble.com/Recursive-digitizePoint-tp15950689s16610p15950689.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list