[Users] How to add register to Action

Pierre Giraud pierre.giraud at camptocamp.com
Fri Jan 7 14:59:47 CET 2011


If you're trying to now when a button corresponding to an action is
clicked, you can add an handler property to your action's config.
There should be no need to use an OpenLayers control for that and even
no need to use a GeoExt.Action.

var action = new Ext.Action({
    tooltip: 'Info',
    iconCls: 'drawpolygon',
    toggleGroup: 'map',
    handler: function(button) {
        // do something
    }
});

Even more, you can simply use an Ext.Button (with the same config)
instead of an Action.

Does that make sense ?

Pierre

On Fri, Jan 7, 2011 at 12:03 PM, Vidal, Antoni <antoni.vidal at icc.cat> wrote:
> Hello list,
>
>
>
> I trying to register a “mousedown” event to an action button but it doesn’t
> work with the following code:
>
>
>
>         action = new GeoExt.Action({
>
>             control: new OpenLayers.Control({eventListeners: {"mousedown":
> this.handleMousedown}}),
>
>             tooltip: 'Info',
>
>             map: map,
>
>             iconCls: 'drawpolygon',
>
>             toggleGroup: 'map'
>
>         });
>
>
>
>         action.control.events.on({
>
>            "mousedown": handleMousedown
>
>         });
>
>
>
>         actions.push(action);
>
>
>
> Any help would be appreciatte.
>
>
>
> Thanks
>
>
>
> Antoni Vidal
>
> Unitat d'Aplicacions SIG-WEB
> Institut Cartogràfic de Catalunya
> Parc de Montjuïc, E-08038 Barcelona
> Tel. (+34) 93 567 15 00 (ext. 3228)
> www.icc.cat
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>



-- 
Pierre GIRAUD
Géomaticien, Analyste

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

Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list