[mapguide-users] OnSelectionChanged in AJAX viewer?

Tanja Suikkanen tanja.suikkanen at dimenteq.fi
Mon Apr 28 02:47:02 EDT 2008


I visited the link you sent Jackie and used it in my code but still my app
doesn't work...
I send here a little snippet of my code:

var map = parent.parent.mapFrame;

    var origOnSelectionChanged = null;

    function MySelectionHandler()
    {
        origOnSelectionChanged();

        var selCount = map.GetSelectedCount();
        if(selCount > 0)
        {
            My function() {}
        }
    }
    window.onload = function() {
        
        var timer;

        var watch = function() {
        
            try {
                if(map.mapInit) {
 
                    clearInterval(timer);

                    origOnSelectionChanged = map.OnSelectionChanged;

                    map.OnSelectionChanged = MySelectionHandler;
                }
            }
            catch(e) {
            }
        };
    
        timer = setInterval(watch, 200);
    };

I tested the code and it never goes to the loop if(map.mapInit) unless I
click my button first.
What is wrong here??

Tanja





More information about the mapguide-users mailing list