SetOnClickListener

(TMarker.SetOnClickListener Method)

Registers an event handler for mouse-click event. The argument-OnClick is a function which would be called when the marker is clicked with the mouse. You should implement the function OnClick.
public SetOnClickListener(OnClick):Void

Parameters

  • OnClick : Object - This function would be called when the marker is clicked with the mouse.You should implement the function.
  • Returns

  • Void
  • Example

    The following example shows how to registe an event handler for mouse-click event. Functor onClick_marker0 will be called when the marker is clicked with the mouse.
    <div id="mapContainer"  style="width: 640px; height: 400px;"></div>
    <script type="text/javascript">
        var map0 = new TMap(mapContainer, 25.7590256665386, -80.3738769902151, 15, mapLoaded, 1, true, "", "hybrid");
    
       
        function mapLoaded() {
            var layer0=map0.AddLayer()
            var marker0=layer0.AddMarker(25.759025666538, -80.3708769902151, "Text Marker0");
            marker0.SetOnClickListener(onClick_marker0);
            
        function onClick_marker0() {
        marker0.ShowInfoWindow("width=240;height=100", "Normal Terrafly Marker", "Hello, This is a Text Marker.");
        }
    </script>
    
        

    See also

  • SetOnRollOverListener()