<div><br></div><div><div>Hi,</div><div><br></div><div>I've seen same behaviour - it appeared only with point features. </div><div>After debugging OL, I gave up and used ugly solution with setTimeout.</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">You may try (without guarantee for success): </span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">setTimeout('drawControl.deactivate();', 100);</span></div>
<div><br></div></div><div><br></div><br><div class="gmail_quote">On Tue, Jan 8, 2013 at 3:23 PM, Alexandre Dubé <span dir="ltr"><<a href="mailto:adube@mapgears.com" target="_blank">adube@mapgears.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Marco,<br>
<br>
  Here's an old 2009 demo featuring the behaviour I explained (click on the image to see the live demo) :<br>
    <a href="http://labs.mapgears.com/en/archive/bdga-wfst" target="_blank">http://labs.mapgears.com/en/<u></u>archive/bdga-wfst</a><br>
<br>
  Select the (+) button and draw a line.  Once completed, you'll see that the draw control gets deactivated and the select control gets activated and selects the newly drawn feature.  See the source code, search for "roadFeatureAdded" :<br>


  <a href="http://dev4.mapgears.com/bdga/bdgaRoads.js" target="_blank">http://dev4.mapgears.com/bdga/<u></u>bdgaRoads.js</a><br>
<br>
  I'd be glad if that could help you.<br>
<br>
Cheers,<br>
<br>
Alexandre<br>
<br>
<br>
On 13-01-08 05:41 AM, Marco Scheuble wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Alexandre,<br>
<br>
I tried your solution, but unfortunately it doesn't work for me ( OL 2.12 ).<br>
Indeed, the feature will be selected, but somehow afterwards it will be<br>
automatically unselected.<br>
In my code-example both alerts will be run: "selected" and "unselected"<br>
<br>
cheers, Marco<br>
------------------------------<u></u>--------------------------<br>
selectControl = new OpenLayers.Control.<u></u>SelectFeature( pois, { onSelect:<br>
onFeatureSelect, onUnselect: onFeatureUnselect } );<br>
<br>
drawControl = new OpenLayers.Control.<u></u>DrawFeature( pois,<br>
OpenLayers.Handler.Point);<br>
drawControl.events.on( {'featureadded': onFeatureAdded, scope: this });<br>
<br>
function onFeatureAdded( addedFeature ){<br>
   addedFeature.feature.state = OpenLayers.State.INSERT;<br>
   selectControl.activate();<br>
   drawControl.deactivate();<br>
   selectControl.select( addedFeature.feature );<br>
}<br>
<br>
function onFeatureSelect( feature ) { alert( "selected" ); }<br>
function onFeatureUnselect( feature ) { alert( "unselected" ); }<br>
------------------------------<u></u>--------------------------<br>
<br>
<br><span><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Selectfeature-after-DrawFeature-tp5018519p5026116.html" target="_blank">http://osgeo-org.1560.n6.<u></u>nabble.com/Selectfeature-<u></u>after-DrawFeature-<u></u>tp5018519p5026116.html</a><br>


Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/openlayers-<u></u>users</a><br>
</font></span></blockquote><span><font color="#888888">
<br>
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
<a href="http://www.mapgears.com" target="_blank">www.mapgears.com</a><br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/openlayers-<u></u>users</a><br>
</font></span></blockquote></div><br>