Hi Ads,<div><br></div><div>It kinda depends what parameters you want in there. The &quot;featureAdded&quot; handler is going to be a generic one, so it will have to get a lot of its information about the feature and so-on at its own runtime. However, what you probably want to do is use a closure:</div>

<div><br><div>var control = new OpenLayers.Control.DrawFeature(<br> someLayer, OpenLayers.Handler.Point, {<br>   featureAdded: this.createFeatureAddedHandler(param1, param2)<br> });<br><br>...<br><br></div><div>function: createFeatureAddedHandler(param1, param2) {<br>

return function(feature) {<br>// In here you have access perpetually to the param1 and param2</div><div>// that were passed in when the handler was created.</div><div>}</div><div>}</div><div><br></div><div>If you&#39;d like further information, the Wikipedia article has some good examples, despite the obtuse introduction: <a href="http://en.wikipedia.org/wiki/Closure_(computer_science)">http://en.wikipedia.org/wiki/Closure_(computer_science)</a></div>

<div><br></div><div><br></div><div><br></div><div><div class="gmail_quote">On Tue, May 18, 2010 at 10:37 PM, adstan <span dir="ltr">&lt;<a href="mailto:nikida78@gmail.com">nikida78@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Hi all,<br>
<br>
Is there a way I could add additional parameters to event listeners? Please<br>
refer to this example:<br>
<br>
var control = new OpenLayers.Control.DrawFeature(<br>
  someLayer, OpenLayers.Handler.Point, {<br>
    featureAdded: someFunction<br>
  });<br>
<br>
...<br>
<br>
function: someFunction(feature, param2) {<br>
...<br>
}<br>
<br>
In the abovementioned example, how can I get the featureAdded event to<br>
insert additional parameters to the &quot;someFunction&quot; method?<br>
<br>
Thanks!!!<br>
<br>
Ads<br>
<font color="#888888">--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/Insert-additional-parameters-to-event-listeners-tp5073085p5073085.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/Insert-additional-parameters-to-event-listeners-tp5073085p5073085.html</a><br>


Sent from the OpenLayers Users mailing list archive at Nabble.com.<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>
</font></blockquote></div><br><br clear="all"><br>-- <br><a href="http://uwmike.com">http://uwmike.com</a><br>
</div></div>