[Users] Dynamic toolbar buttons for vector editing - how?

Andreas Hocevar ahocevar at opengeo.org
Tue Sep 28 23:26:33 CEST 2010


HI,

sounds like you use GeoExt.Action? No need to create dummy buttons. The only thing you should do is create a button with an action, instead of adding the action to a toolbar directly:

var button = new Ext.Button(myAction);
...
bbar: [button]

Now you can either show/hide or enable/disable your buttons, e.g.

button.hide();

Regards,
Andreas.
 
On Sep 28, 2010, at 21:31 , David E. Reksten wrote:

> Hi,
> 
> I have an application where users can add one or many vector layers to
> the base map. I have a treePanel with radio buttons that lets the
> users activate one of their vector layers. This works very well.
> 
> When a layer is activated, I want to enable a couple of buttons on the
> toolbar (bbar on the mapPanel) to allow drawing and editing polygons.
> When there are no user defined vector layers available (ie., none
> selected), I want the buttons to either disappear or to be disabled.
> What is the best strategy for this?
> 
> I have tried to set up "dummy" buttons on the toolbar and dynamically
> set their "control" and "map" properties when the selected vector
> layer changes, but cannot get it to work.
> 
> Regards,
> .david
> 
> PS: Big thanks to the GeoExt team for all the hard work and congrats
> for v1rc1 :-)
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list