PDA

View Full Version : Same toggleGroup, 2 toolbars



giraam
25 Oct 2010, 6:29 AM
Hi people,

I want to know if I can have a toggleGroup that works for 2 different toolbars.

I want to have the main buttons at the tbar and navigation, help, etc. at the bbar.

Thank you!!

Condor
25 Oct 2010, 7:33 AM
Yes, toggleGroups are globally registered in the Ext.ButtonToggleMgr, so it doesn't matter where your buttons reside.

giraam
25 Oct 2010, 10:08 AM
Yes, toggleGroups are globally registered in the Ext.ButtonToggleMgr, so it doesn't matter where your buttons reside.

I see that the object has this 3 functions:

Ext.ButtonToggleMgr.getPressed(group);
Ext.ButtonToggleMgr.register(btn);
Ext.ButtonToggleMgr.unregister(btn);
Apparently I have to pass an button object as a parameter to the function register, right? I am working with OpenLayers controls and wonder if I should register each of the controls that I created.

If you could provide me an example I would be so grateful!

Condor
25 Oct 2010, 10:23 AM
You don't need to use ButtonToggleMgr directly. A button calls ButtonToggleMgr.register automatically if you specify a toggleGroup.

giraam
25 Oct 2010, 10:48 AM
You don't need to use ButtonToggleMgr directly. A button calls ButtonToggleMgr.register automatically if you specify a toggleGroup.

OK, thanks! Maybe is an issue with OpenLayers because the buttons works as expected when they are in the same toolbar but they don't when using 2 toolbars :S

I'll post the solution as I find it.