[OpenLayers-Users] Control TYPE_TOOL and trigger event

Armin Burger armin.burger at gmx.net
Tue Mar 16 14:09:45 EDT 2010


Just in case someone might be interested in the sort of solution I got 
for this issue: The only way I found was to modify the OL source code 
for the Control.Panel object. Under the method 'activateControl' I added 
the lines

if (control.type == OpenLayers.Control.TYPE_TOOL) {
     if (control.trigger) control.trigger();
}

This causes the trigger method for a control of TYPE_TOOL to be launched 
on click on the control button (if this method is defined for the control).

Best regards
Armin


On 15/03/2010 21:05, Frost89 wrote:
>
> You should check if the control has an actual type (using your favorite
> debugger). If it is null then it might be necessary to specify the
> controltype in the constructor, like this:
> new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon,
> {
>      type: OpenLayers.Control.TYPE_TOOL
> });
> In this example my control's type was null by default, so I had to set the
> type myself. This could be the same problem you're having.



More information about the Users mailing list