scriptsharp icon indicating copy to clipboard operation
scriptsharp copied to clipboard

MapEvents.AddHandler MapEventArg vs MapMouseEventArgs

Open larrywelch opened this issue 8 years ago • 0 comments

I'm implementing a control that will display pushpins on a bing map. When the user hovers or clicks on the pushpin I'd like to display an info box. I've been able to successfully register for and handle the event. However, the MapEventArg object doesn't contain enough data. Using the debugger I discovered that the object passed to the event handler was actually a MapMouseEventArg. Simple solution then, just cast the object to a MapMouseEventArg and finish up my code. Unfortunately that didn't work. Following is the js code that was produced: IGT.AG.ClientUI.View.ContractsWithinRadiusView.mapPinClickEventHandler = function IGT_AG_ClientUI_View_ContractsWithinRadiusView$mapPinClickEventHandler(args) { var m = Type.safeCast(args, MapEventArgs); var mArgs = Type.safeCast(args, MapMouseEventArgs); if (mArgs != null) { if (mArgs.targetType === 'pushpin') { ...

The debugger reports that MapEventArgs is undefined. I can manually alter the resulting code to get it to work but I'd rather understand what I'm doing wrong, or fix something if it's broken.

Any help will be greatly appreciated!

larrywelch avatar Mar 02 '17 17:03 larrywelch