I am going to try this again, and include the relevant code this time in the 
post.

How can I enable default event handling for a textfield input in a custom 
control?

When I place a textfield into a control on the map, it does not receive mouse 
events or keyboard events.  
How can I make the textfield receive these events and handle them as it 
normally would?

Any help greatly appreciated.

This is example of what I am talking about:  
http://javamike9.webs.com/oltextControl.htm




Here is the (very simple) javascript portion of the problem:

OpenLayers.Control.TextFieldControl = OpenLayers.Class(OpenLayers.Control, 
{
  draw: function() {
   OpenLayers.Control.prototype.draw.apply(this, arguments);
   var element = document.createElement('div');
   element.className = this.displayClass + 'Element';
   var inputElement = document.createElement('input');
   inputElement.type='text';
   inputElement.value='test';
   element.appendChild(inputElement);

   //element.innerHTML = "<input type='text' value='test'></input>";
   this.div.appendChild(element);
   return this.div;
  },
  CLASS_NAME: 'OpenLayers.Control.TextFieldControl'
});

function init()
{
  var map = new OpenLayers.Map( 'map' );
  var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
    "http://labs.metacarta.com/wms/vmap0";,
    {layers: 'basic'} 
);
  map.addLayer(layer);
  var myCustomControl = new OpenLayers.Control.TextFieldControl();
  map.addControl(myCustomControl);
  map.zoomToMaxExtent();
}


      
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to