<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=712363617-27042010><FONT face=Arial 
color=#0000ff size=2>Hi Sarah,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=712363617-27042010><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=712363617-27042010><FONT face=Arial 
color=#0000ff size=2>the example shows how to retrieve features from a wms 
layer. But you have a vector layer (wfs layer). So you can link the 
SelectFeatureControl to that layer. </FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2>ctrlSelectFeatureOptions = { 
clickout: true, toggle: true, multiple: false, hover: false, toggleKey: 
"ctrlKey", multipleKey: "none", box: false };<BR>ctrlSelectFeature = new 
OpenLayers.Control.SelectFeature(<SPAN class=712363617-27042010>layerWFS</SPAN>, 
ctrlSelectFeatureOptions);</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=712363617-27042010><FONT face=Arial color=#0000ff 
size=2>//optional</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff 
size=2>ctrlSelectFeature.onSelect&nbsp;&nbsp;&nbsp; = function (ft) {&nbsp; 
};<BR>ctrlSelectFeature.onUnselect&nbsp; = function (ft) {&nbsp; };</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff 
size=2>ctrlSelectFeature.activate();<BR></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=712363617-27042010>If you 
now click on a feature from your wfs it will be&nbsp;selected. If you do not add 
a own styleMap to your wfs layer, the default styleMap is used to display the 
features for the different modes (unselected, selected or 
temporarily).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=712363617-27042010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT><SPAN class=712363617-27042010></SPAN></FONT><FONT face=Arial 
color=#0000ff size=2><SPAN class=712363617-27042010>If you want use your own 
styleMap, you have to declare the styles for the different modes (at last 
'default' for unselected features and 'select' for selected features) to see 
that you have select a feature.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=712363617-27042010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=712363617-27042010>Arnd</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=712363617-27042010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B> Sarah Schuessler 
[mailto:sarah_flip@yahoo.de] <BR><B>Gesendet:</B> Dienstag, 27. April 2010 
09:57<BR><B>An:</B> Arnd Wippermann<BR><B>Cc:</B> 
users@openlayers.org<BR><B>Betreff:</B> AW: [OpenLayers-Users] unselect did not 
work<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif">
<DIV>Hi Arnd,<BR><BR>thanks for your answer!<BR>Please read below.<BR></DIV>
<DIV 
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif"><BR>
<DIV 
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif"><FONT 
face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold"></SPAN></B><BR></FONT><BR>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2>i'm not sure, why you need a layer for your selected 
feature. Why not use the selectFeatureControl on the wfs 
layer.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010></SPAN><SPAN>I use my 
Control.SelectFeature with my wfs layer(wfs2)- or don`t I use the event right? 
(event.register instead of events.on). I get along with this example: <A 
href="http://dev.openlayers.org/releases/OpenLayers-2.9/examples/getfeature-wfs.html" 
target=_blank>http://dev.openlayers.org/releases/OpenLayers-2.9/examples/getfeature-wfs.html</A> 
to get back a visual selecting for the user and get back some information about 
the selected feature.</SPAN><BR><BR></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2>About your question. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2>The problem is the&nbsp;feature object. You add not a new 
feature to a new layer. Instead it seems, that you&nbsp;move the selected 
feature from the wfs layer&nbsp; to the new layer. That means 
wfs.event.on("unselected") cann't work, because your selectFeatureControl works 
only for the wfs layer.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010></SPAN>Yes I thought 
something like that, but could not manage to solve this. Thanks for your 
example! <BR></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010>
<DIV dir=ltr align=left><SPAN class=511545116-26042010></SPAN><FONT 
face=Arial><FONT color=#0000ff><FONT size=2>U<SPAN class=511545116-26042010>se a 
clone of the feature and remove the only feature on your select 
layer.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=511545116-26042010></SPAN></FONT></FONT></FONT>&nbsp;</DIV></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=511545116-26042010><FONT face=Arial 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp; layerWFS.events.on({'featureselected': 
function(feature){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
selectLayer.addFeatures([feature.feature.clone()]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//selectLayer.addFeatures([feature.feature]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
alert(this.selectedFeatures.length);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
'featureunselected': 
function(feature){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
selectLayer.removeFeatures([selectLayer.features[0]]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//selectLayer.removeFeatures([feature.feature]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
alert(this.selectedFeatures.length + " - 
unselected");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
});<BR></FONT></SPAN></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=511545116-26042010></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=511545116-26042010>A bit confusing is also the style you add as default 
style to the select layer. It looks like you select a feature on the wfs layer, 
but it's really the not selected feature on the select 
layer.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=511545116-26042010></SPAN></FONT></FONT></FONT>So I have to register a 
select style to my wfs layer and cancel select layer, am I right? <BR><BR>best 
regards<BR>Sarah<BR></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=511545116-26042010>Arnd</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><BR></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B> users-bounces@openlayers.org 
[mailto:users-bounces@openlayers.org] <B>Im Auftrag von </B>Sarah 
Schuessler<BR><B>Gesendet:</B> Montag, 26. April 2010 10:28<BR><B>An:</B> 
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] unselect did not 
work<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV 
style="FONT-SIZE: 12pt; COLOR: rgb(0,0,0); FONT-FAMILY: times new roman,new york,times,serif">
<DIV>Hi list,<BR><BR>I try to use Control.SelectFeature but I can`t unselect 
(selection layer does not get removed). Here is my code:<BR>var selectFeature = 
new OpenLayers.Control.SelectFeature(wfs2, {clickout: true, multiple: false, 
hover: false, toggle:false, toggleKey: "shiftKey", box: true, multipleKey: 
"ctrlKey"});<BR><BR>var wfs2 = new OpenLayers.Layer.Vector("WFS_Waldschutz", 
<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
{ styleMap: styleMap,<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strategies: [new 
OpenLayers.Strategy.Fixed()],<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; protocol: new 
OpenLayers.Protocol.WFS({ <BR><SPAN>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; url: "<A 
href="http://myserver:81/geoserver/wfs?service=wfs" target=_blank 
rel=nofollow>http://myserver:81/geoserver/wfs?service=wfs</A>", 
</SPAN><BR><SPAN>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; featureNS: "<A 
href="http://mycomp.org" target=_blank rel=nofollow>http://mycomp.org</A>", 
</SPAN><BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; featureType: "mylayer", 
<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; geometryName: "SHAPE", <BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
srsName: "EPSG:4326",<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; version: "1.1.0" 
<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }),<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
projection: new OpenLayers.Projection("EPSG:4326")<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });&nbsp;&nbsp;&nbsp; 
<BR><BR>wfs2.events.on({'featureselected': function(feature){ 
<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
select.addFeatures([feature.feature]); <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; alert(this.selectedFeatures.length); <BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; }, <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
'featureunselected': function(feature){<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; 
select.removeFeatures([feature.feature]);<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; alert(this.selectedFeatures.length); 
alert("unselected");<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
},<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; });&nbsp; <BR><BR>var select = new 
OpenLayers.Layer.Vector("Selection", { <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; styleMap: new 
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]), 
<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
displayInLayerSwitcher: true, visibility: true});<BR><BR>featureselected works 
(at firebug I can see that my app does not get to this break point). What`s 
wrong?<BR><BR>Thank you for any hints.<BR>best 
regards<BR>Sarah<BR><BR></DIV></DIV><BR></DIV></DIV></DIV><BR></BODY></HTML>