I have added a control to a GeoExt.Action with a handler function. When the toolbar item is clicked, using the handler I Open a window, that contains a box component, and then as the map is clicked to draw a line I want to write to the window on click 2,3,...<br>
Everything works well in FireFox and Chrome, and not at all in IE (7 & 8)<br><br>In IE nothing is written to the box component on mouse clicks, the double click to finish the line is sluggish and clicking the window Done button to close the window throws an error.<br>
<br>I've beat my self up and am asking for suggestions and/or insights.<br><br>the live example is at <a href="http://www.gis.catawba.nc.us/ol/toolbar.html">http://www.gis.catawba.nc.us/ol/toolbar.html</a><br><br>Here is my control<br>
<br>var line= new OpenLayers.Control.DrawFeature(vector,<br> OpenLayers.Handler.Path, {<br> 'callbacks': {<br> 'point': addPoint<br> }<br> }<br> );<br>
<br>The toolbar action<br><br>action = new GeoExt.Action({<br> text: "draw line",<br> //control: new OpenLayers.Control.DrawFeature(<br> // vector, OpenLayers.Handler.Path<br> //),<br>
control: line,<br> map: map,<br> toggleGroup: "draw",<br> allowDepress: false,<br> tooltip: "draw line",<br> handler: function(){<br> if(!win2){<br>
point_count = 0;<br> total_distance = 0;<br> win2 = new Ext.Window({<br> applyTo:'mwin',<br> layout:'auto',<br> width:220,<br> height:'auto',<br>
items: new Ext.BoxComponent({<br> applyTo:'bc2'<br> }),<br> CloseAction:'hide',<br> plain: false,<br> buttons: [{<br> text: 'DONE',<br>
handler: function(){<br> win2.hide();<br> } <br> }]<br> });<br> }<br> win2.show(this);<br> },<br>
group: "draw"<br> });<br> actions["draw_line"] = action;<br> toolbarItems.push(action);<br><br>The callback function<br><br>function addPoint(pt) {<br> var bc2;<br> point_count += 1;<br>
if (point_count > 1) {<br> var dist;<br> dist = lastpt.distanceTo(pt);<br> total_distance += dist;<br> //the nex two line work in firefox, not inie<br> bc2 = Ext.get('bc2'); <br>
bc2.insertHtml('beforeEnd','<div>Distance: ' + dist.toFixed(1) + '</div>');<br> } else {<br> // on the first mouse click do this <br> bc2 = Ext.get('bc2');<br>
bc2.insertHtml('beforeEnd','<div>hello</div>');<br> }<br> lastpt = pt.clone();<br> }<br><br>The html<br><br><div id='mwin' class="x-hidden"><br>
<div class="x-window-header">Measure Distance</div><br> <div id='bc2'>Click to add points</div><br> </div><br>