[OpenLayers-Users] Problems with selectControl after upgrading from OL 2.6 to 2.7

Eric Lemoine eric.c2c at gmail.com
Fri Jan 16 00:04:54 EST 2009


On Thu, Jan 15, 2009 at 9:46 PM, Zer <zer_matt at hotmail.com> wrote:
>
> Hi!
>
> Thanks! That fixed my first probelem!
>
> But the 'onSelect' still doesn't get called, unless I remove the activate
> function. Any ideas?

Do not override the activate method, instead register an "activate" listener:

var ctrl = new OpenLayers.Control.SelectFeature(layer, {
    eventListeners: {
        "activate": function() {
            alert("control activated");
        }
    }
});

or (after the control creation):

ctrl.events.on({
    "activate": function() {
       alert("control activated");
    }
});

Cheers,
--
Eric



More information about the Users mailing list