Ok I see that you added the control to your map but "featureselected" is
an event of the vector layer not of the control. See this example
http://www.openlayers.org/dev/examples/select-feature-multilayer.html
so you need something like:
var vectors1 = new OpenLayers.Layer.Vector(bla)
selectControl = new OpenLayers.Control.SelectFeature(
[vectors1],
{
clickout: true, toggle: false,
multiple: false, hover: false,
toggleKey: "ctrlKey", // ctrl key removes from selection
multipleKey: "shiftKey" // shift key adds to selection
}
);
and finally
map.addControl(selectControl);
selectControl.activate();
Maybe you are missing the adding the vector layer to the SelectFeature control
step as above in the example?
stash wrote:
Hello,
Thanks for your advices.
You wrote that in my config the projection should be 900913. Of course, you
are right, I already fixed that problem before I had posted the code, sorry.
Unfortunately, I copied some old code (but the rest of the config didn't
change).
You wrote in point 2 that my strategy could be wrong. I don't know a lot
about Strategy, too, I copied the 'strategies: [new
OpenLayers.Strategy.Fixed()]' parameter from an example. But the problem is,
that if I use an other base layer (for example a wms in epsg 4326) the
getfeature works perfect, I didn't change the code of my wfs and of my wfs
getfeature.
According to your question what is happening, when i click a feature, here
is the code. It is nothing special, simply a message box with one parameter,
which is shown on my screen.
//Diese Funktion wird aufgerufen, sobald auf eine Polygongeometrie
geklickt wird
control.events.register("featureselected", this, function(e)
{ alert(e.feature.data.P_Name); });
map_2.addControl(control); //Control added
control.activate(); //... activated
Thanks for your help.
Best Regards
_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users