I have created an OpenLayers.Control.MousePosition:

var coord = new OpenLayers.Control.MousePosition({
            prefix: 'You are here: ',
            separator: ' | ',
            numDigits: 5,
            emptyString: 'Mouse is not over map.',
            displayProjection: "EPSG:4326",


And a Toolbar:

  var toolBar = new Ext.Toolbar({
            items: [
                  xtype: "label",
                  text: "Scale = 1:  ",
                    xtype: 'displayfield',

This Toolbar is the tbar in my mapPanel:

var mapPanel = new GeoExt.MapPanel({
          region: "center",
          map: map,

Is there any posibillity to get the Value of the Mouse Position as a displayfield in my Toolbar? I already tried this: http://trac.geoext.org/attachment/ticket/195/195.1.patch, but my map is not working with " new GeoExt.Toolbar.ControlDisplay". Is there anything i can use instead?

I am using: OpenLayers 2, GeoExt and ExtJS.


It's working for me with a textfield (id: 'TextField') in the tbar and with the code:

var test= Ext.getCmp('TextField');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.