[Users] OpenLayers.Control.MousePosition vs ExtJS 3.2.1

Adam Ratcliffe adam at prema.co.nz
Sat Aug 7 00:07:36 CEST 2010


Hi Alex,

I found the patch didn't work for me either.  My implementation is below:

Ext.namespace('GeoSmart.Toolbar'); 

GeoSmart.Toolbar.MousePosition = function(config) { 
 	this.map = config.map || null; 
 	this.controlOptions = config.controlOptions || {}; 
 	GeoSmart.Toolbar.MousePosition.superclass.constructor.call(this, this.text || ""); 
}; 
Ext.extend(GeoSmart.Toolbar.MousePosition, Ext.Toolbar.TextItem, { 
    onRender : function(ct, position){
        this.el = ct.createChild({tag:'div', cls: 'xtb-text'}, position);
 	    var config = OpenLayers.Util.extend(this.controlOptions, { 
 		    div:this.el.dom
 		}); 
 		this.control = new OpenLayers.Control.MousePosition(config); 
 		this.map.addControl(this.control); 
    }
}); 

Cheers
Adam

On 6/08/2010, at 9:33 PM, Alexandre Saunier wrote:

> Hello,
> 
> I have tried to integrate a MousePosition control within a mappanel
> toolbar as described in
> http://trac.geoext.org/attachment/ticket/195/195.0.patch
> 
> But (at least?) with ExtJS 3.2.1 it doesn't seem to work: the "el"
> property of the component is not defined in the render() method. Thus
> coords are displayed on the map, not in the toolbar. If placed in an
> afterRender() method, "el" seems OK (including the coordinates from
> the control) but nothing is displayed anywhere. As if the "el" element
> was not updated in the toolbar. No more success using "render" or
> "afterrender" listeners.
> 
> Does anyone know if something has changed in that case when using ExtJS 3.2.1?
> 
> Thanks,
> alex
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list