Hi,<br><br>I presume you have to specify the event name somehow. Try including this:<br><br>dosomething = function (feature) <br>{<br><br>}<br><br> ...callbacks: {'<span>featureAdded</span>': dosomething}...<br><br>
<br>All the best,<br>Adorian<br><br><div class="gmail_quote">On Fri, Dec 5, 2008 at 12:59 PM, Nino Saturnino Martinez Vazquez Wael <span dir="ltr"><<a href="mailto:nino.martinez@jayway.dk">nino.martinez@jayway.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Guys<br>
<br>
Im doing a integration for the Apache Wicket framework(<br>
<a href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-openlayers" target="_blank">http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-openlayers</a><br>
), and want to add some more features. Im looking into adding the<br>
possibility to draw polygons, however I cant find a example where theres<br>
a simple callback involved once the polygon are drawn, however the api<br>
mentions it's possible.<br>
<br>
As you can see from the below code the only thing I need for this little<br>
thing to work are the function that calls the alert to be picked up.<br>
Please say if you want me to elaborate further.<br>
<br>
<br>
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"><br>
<head><br>
<title>OpenLayers Regular Polygon Example</title><br>
<script src="<a href="http://openlayers.org/api/OpenLayers.js" target="_blank">http://openlayers.org/api/OpenLayers.js</a>"></script><br>
<script type="text/javascript"><br>
var map, polygonControl;<br>
OpenLayers.Util.onImageLoadErrorColor = "transparent";<br>
function init(){<br>
map = new OpenLayers.Map('map');<br>
<br>
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br>
"<a href="http://labs.metacarta.com/wms/vmap0" target="_blank">http://labs.metacarta.com/wms/vmap0</a>?", {layers: 'basic'});<br>
<br>
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");<br>
<br>
map.addLayers([wmsLayer, polygonLayer]);<br>
map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
map.addControl(new OpenLayers.Control.MousePosition());<br>
<br>
polyOptions = {sides: 4, callbacks:<br>
{function(value){alert('yeeeha');}} };<br>
polygonControl = new<br>
OpenLayers.Control.DrawFeature(polygonLayer,<br>
<br>
OpenLayers.Handler.RegularPolygon,<br>
{handlerOptions: polyOptions<br>
});<br>
<br>
map.addControl(polygonControl);<br>
<br>
map.setCenter(new OpenLayers.LonLat(0, 0), 3);<br>
<br>
document.getElementById('noneToggle').checked = true;<br>
document.getElementById('irregularToggle').checked = false;<br>
}<br>
function setOptions(options) {<br>
polygonControl.handler.setOptions(options);<br>
}<br>
function setSize(fraction) {<br>
var radius = fraction * map.getExtent().getHeight();<br>
polygonControl.handler.setOptions({radius: radius,<br>
angle: 0});<br>
}<br>
</script><br>
<br>
</head><br>
<body onload="init()"><br>
<h2 id="title">OpenLayers Regular Polygon Example</h2><br>
<p id="shortdesc"><br>
Shows how to use the RegularPolygon handler to draw features with<br>
different numbers of sides.<br>
</p><br>
<div id="map" class="smallmap"></div><br>
<div id="config"><br>
<br>
<ul id="controls"><b>Map Controls</b><br>
<br>
<li><br>
<input type="radio" name="type"<br>
value="none" id="noneToggle"<br>
onclick="polygonControl.deactivate()"<br>
checked="checked" /><br>
<label for="noneToggle">navigate</label><br>
</li><br>
<li><br>
<input type="radio" name="type"<br>
value="polygon" id="polygonToggle"<br>
onclick="polygonControl.activate()" /><br>
<label for="polygonToggle">draw polygon</label><br>
</li><br>
<br>
</ul><br>
<br>
</div><br>
</body><br>
<br>
</html><br>
<br>
<br>
<br>
<br>
-Nino<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Dr. Adorian Ardelean<br>coordinator of myNature Project<br><br><a href="http://mybiosis.info/nature/portal.php?pagename=firstpage">http://mybiosis.info/nature/portal.php?pagename=firstpage</a> [a Romanian biodiversity-database]<br>
<a href="http://mybiosis.info/nature/portal.php?pagename=adorian">http://mybiosis.info/nature/portal.php?pagename=adorian</a> [CV]<br>