ADF Tutorials
ADFTutorials_VBNet\ScriptableControls\MapCoordinateDisplay\javascript\MapCoordinateDisplay.js
 Copyright 2010 ESRI
 
 All rights reserved under the copyright laws of the United States
 and applicable international laws, treaties, and conventions.
 
 You may freely redistribute and use this sample code, with or
 without modification, provided you include the original copyright
 notice and use restrictions.
 
 See <a href="http://help.arcgis.com/en/sdk/10.0/usageRestrictions.htm">the use restrictions</a>.
 

/// <reference name="MicrosoftAjax.js"/>
/// <reference assembly="ESRI.ArcGIS.ADF.Web.UI.WebControls" name="ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.references.js"/>

Type.registerNamespace('MapCoordinateDisplay');

MapCoordinateDisplay.MapCoordinateDisplay = function(element) {
    MapCoordinateDisplay.MapCoordinateDisplay.initializeBase(this, [element]); 
    this._map = null;                       
    this._displayLabel = null;
}

MapCoordinateDisplay.MapCoordinateDisplay.prototype = {
    initialize : function() {     
        MapCoordinateDisplay.MapCoordinateDisplay.callBaseMethod(this, 'initialize');
        // Add custom initialization here        
        if(this._map) {
            this._map.add_mouseMove(Function.createDelegate(this, this._onMapMouseMove));
        }
    },   
    _onMapMouseMove : function(sender, args) {
      // Display the co-ordinates               
      if(this._displayLabel) {
        this._displayLabel.innerHTML = args.coordinate.toString();
      }
    }, 
    get_map : function() {
        return this._map;
    },
    set_map : function(value) {
        this._map = value;  
    },
    get_displayLabel : function() {
        return this._displayLabel;
    },
    set_displayLabel : function(value) {
        this._displayLabel = value;
    },    
    dispose : function() {
        //Add custom dispose actions here        
        MapCoordinateDisplay.MapCoordinateDisplay.callBaseMethod(this, 'dispose');
    }
}

MapCoordinateDisplay.MapCoordinateDisplay.registerClass('MapCoordinateDisplay.MapCoordinateDisplay', Sys.UI.Control);    

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();