[OpenLayers-Users] how to deactivate editingtoolbar after featureadded

G. Allegri giohappy at gmail.com
Wed Jan 28 11:49:51 EST 2009


Sorry, I've sent too fast the solution. It works, but how can I
overload the onClick event on the control to alert the user with "a
feature has been already added"?
In this case I don't have to stop observing the click but I need to
handle it in a custom way...

2009/1/28 G. Allegri <giohappy at gmail.com>:
> Solved (somehow...):
>
>       function locAdded(feature){
>                for(i=0;i<3;i++){
>                        panel.controls[i+1].deactivate();
>                        OpenLayers.Event.stopObservingElement(panel.controls[i+1].panel_div);
>                }
>        }
>
> giovanni
>
> 2009/1/28 G. Allegri <giohappy at gmail.com>:
>> Hello list,
>> I'm using the editingtoolbar control panel. I need to disable it after
>> any feature has been added (point, line or polygon), and reactivate it
>> if the feature gets deleted.
>> I've seen that calling:
>>
>> function locAdded(feature){
>>                panel.controls[1].deactivate();
>>                panel.controls[2].deactivate();
>>                panel.controls[3].deactivate();
>> }
>>
>> deactivate the controls unitl the user click on the panel again...
>> this is not what I need. In fact the panel control has an onClick
>> handler that activate the control on which the onClick event has
>> happened (line 212 in Panel.js).
>> I've tried deactivating directly the panel, but the panel gets deleted.
>>
>> I need the panel to remain visible but "unclickable", until the unique
>> feature has been deleted from the layer.
>>
>> I've tried to overload the onClick panel's method, but I couldn't get
>> it to work...
>> Thanks for any hint.
>>
>> giovanni
>>
>



More information about the Users mailing list