[OpenLayers-Users] select feature control not working

Eric Lemoine eric.lemoine at camptocamp.com
Thu Jun 3 07:31:16 EDT 2010


On Thu, Jun 3, 2010 at 12:01 PM, Imran Rajjad <rajjad at gmail.com> wrote:
> I`m trying to run a function on clicking and highlighting of a vector
> layer. the events do not seem to trigger..
>
> what am i doing wrong here?
>
> my code
>
>
>
> var report = function(e) { // it will be called when event is trigered
> from eventListeners
>                console.log(e.type, e.feature.id);
>                //alert(e.feature.id);
>
>            };
>
>            var highlightCtrl = new
> OpenLayers.Control.SelectFeature(vector_layer, {
>                hover: true,
>                highlightOnly: true,
>                renderIntent: "highlight",
>                eventListeners: {
>                    beforefeaturehighlighted: report,
>                    featurehighlighted: report,
>                    featureunhighlighted: report
>                }
>            });
>
>            var selectCtrl = new OpenLayers.Control.SelectFeature(vector_layer,
>                {clickout: true}
>            );
>
>            map.addControl(highlightCtrl); // add high lighting
>            map.addControl(selectCtrl); // add selection
>
>            highlightCtrl.activate();
>            selectCtrl.activate();


What OpenLayers version do you use? Does the highlight-feature.html
example of your OpenLayers distribution work?

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list