Announcement Announcement Module
Collapse
No announcement yet.
Disable Buttons in a CommandGroup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Disable Buttons in a CommandGroup

    I want disable all the buttons contained in a CommandGroup.

    CommandGroup.setEnabled(false)

    dont work.

  • #2
    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.

    Comment


    • #3
      If I want disable all the commands in the toolbar?

      I could do it rewriting setEnabled of CommandGroup

      Code:
          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!

      Comment

      Working...
      X