OpenLayers 2.9 RC 2<br><br>I'm attempting to create a custom tool and toolbar class but I seem to be running into an issue with the custom toolbar.<br><br>Here is my code below<br><br><div style="margin-left: 40px; font-family: verdana,sans-serif;">
ZoomToAgreementExtent = OpenLayers.Class(OpenLayers.Control, {<br> type: OpenLayers.Control.TYPE_BUTTON,<br> trigger: function() {<br> if (this.map) {<br> alert('this is a test');<br> } <br>
},<br> CLASS_NAME: "ZoomToAgreementExtent"<br>});<br><br>ApplicationToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {<br> initialize: function(options) {<br> OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);<br>
this.addControls([<br> new OpenLayers.Control.Navigation(),<br> new OpenLayers.Control.ZoomBox(),<br> new ZoomToAgreementExtent()<br> ]);<br> },<br> draw: function() {<br> var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);<br>
this.activateControl(this.controls[0]);<br> return div;<br> }<br> CLASS_NAME: "ApplicationToolbar"<br>});<br></div><br>Then on my map init method I do this:<br><br><div style="margin-left: 40px;">
var appToolbar = new ApplicationToolbar();<br>map.addControl(appToolbar);<br></div><br>The ZoomToAgreementExtent control seems to work fine but when I try and add the ApplicationToolbar (which I based on the NavToolbar) I get the following error in FireBug:<br>
<br><div style="margin-left: 40px;">this.initialize is undefined in OpenLayers-2.9-rc2.js on line 117.<br></div><br>I assume that there isn't a bug in the Open Layers library but instead there is something wrong with my code.<br>
<br>Any ideas?<br><br>Thanks<br><br>Andrew<br><br>