[mapguide-users] Event that captures mouse action

Langen, Gido Gido.Langen at NRCan-RNCan.gc.ca
Thu Nov 5 09:57:48 EST 2009


Hi Kenneth,
 
Thanks so much for your example.  It worked really well.  I have listed
my working copy as further reference.  
Now, I have one more question: I want to associate the functionality
with a new command on the toolbar which is easy enough.  The trouble is
that the new command can be activated by clicking it but it does not
STAY selected like the built-in commands once they have been activated.
So, how can I make a custom command stay selected after it has been
activated?
 
Thanks,
Gido 
 
 
// Copy original function to new pointer
origOnMapLoadingFunc = parent.parent.mapFrame.OnMapLoading;
 
// Redefine old OnMapLoading function
parent.parent.mapFrame.OnMapLoading = function() {
  // Does somethimg
}
 
// Call "new" functionality
paren.parent.mapFrame.OnMapLoading();
 
//Run old function 
origOnMapLoadingFunc();


________________________________

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kenneth
Skovhede, GEOGRAF A/S
Sent: November 4, 2009 00:45
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Event that captures mouse action


There is a function called "OnMapLoading" which you can hijack like
this:

//Keep a reference to the original function
GetMapFrame().original_OnMapLoading = GetMapFrame().OnMapLoading;

//Assign a new function
GetMapFrame().OnMapLoading = function(){

    try {
        
       //Place more meaningfull code here :)
        alert("The map is now loading");

    } catch (e)  //Make sure our code does not break the function
    {} 

    //Activate the actual MapGuide handler
    original_OnMapLoading();
};


Regards, Kenneth Skovhede, GEOGRAF A/S


Langen, Gido skrev: 

	Does anyone know how to capture a mouse click on the map?  I
want to do some scale dependent processing and want to capture the scale
after zooming in/out.  I need to know the scale right after the zoom
in/out, before the map is redrawn.  

	Thanks for any insight, 
	Gido 

	
________________________________


	_______________________________________________
	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/20091105/ce4d67c4/attachment.html


More information about the mapguide-users mailing list