Hi All,

I've followed all the documentation I could find regarding custom
buttons and attaching events. I have tried the following code options
to no avail. Help would be appreciated.

1)
var buttonzos = new OpenLayers.Control.Button({displayClass:
"ZoomToOSButton", active: true, trigger: function() {alert("zos");}});
// have also tried trigger: RoutePlanner.zoomToOs where zoomToOs is a
variable within RoutePlanner containing a function.

2)
var buttonzm = new OpenLayers.Control.Button({displayClass: "ZoomModeButton"});
    buttonzm.events.register("activate",buttonzm, function(e) {
            alert("butclick");
    });

3)
var buttonzm = new OpenLayers.Control.Button({displayClass: "ZoomModeButton"});
    map.events.register("activate",buttonzm, function(e) {
            alert("butclick");
    });
// note the map.events in number 3, as opposed to buttonzm.events in number 2

3 does indeed work, but fires no matter where you click on the map,
not just on the button.

I'm sure what I need is obvious, but nothing is working for me.

Thanks in advance.

Adam.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to