View Full Version : Disable Buttons in a CommandGroup
besbello
Aug 31st, 2004, 11:51 AM
I want disable all the buttons contained in a CommandGroup.
CommandGroup.setEnabled(false)
dont work.
Keith Donald
Aug 31st, 2004, 08:19 PM
Currently commandGroup.setEnabled(boolean) will disable all group controls that are buttons; for example, a menu or a popup pull down menu. It will not cascade enabled state to all members of the group.
The question is, does this cascade setEnabled make sense, and if so, what should be the contract for the method. Just disable the buttons associated with action command members? I think this would be good, but I don't think it should be default behaivior. The action commands really should know when they should be enabled/disabled themselves.
besbello
Aug 31st, 2004, 09:06 PM
If I want disable all the commands in the toolbar?
I could do it rewriting setEnabled of CommandGroup
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
Iterator it = getMemberList().iterator();
while (it.hasNext()) {
GroupMember gcm = (GroupMember) it
.next();
gcm.setEnabled(enabled);
}
}
is the unique solution that see because
getMemberList() is protected.
Other solution?
THANKS!
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.