Loading ...
Sorry, an error occurred while loading the content.

disabling a menu

Expand Messages
  • Todd Wells
    I d like to disable one of the menus on my menubar depending on the context, but I can t quite figure out the right way to do it. What I *thought* was the
    Message 1 of 5 , Jun 30, 2008
    • 0 Attachment
      I'd like to disable one of the menus on my menubar depending on the context, but I can't quite figure out the right way to do it.

      What I thought was the right way doesn't seem to have any effect (the menu is still enabled and I can still pick any item on it):

      var testPassMenu = oMenuBar.getSubmenus()[1];
      testPassMenu.cfg.disabled = true;

      What's the right way to do this?


    • wally.ritchie
      ... context, ... (the menu ... I use: testPassMenu.cfg.setProperty( disabled , true); although what you are doing should also work - it does for me. Make sure
      Message 2 of 5 , Jun 30, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "Todd Wells" <ttopwells@...> wrote:
        >
        > I'd like to disable one of the menus on my menubar depending on the
        context,
        > but I can't quite figure out the right way to do it.
        >
        > What I *thought* was the right way doesn't seem to have any effect
        (the menu
        > is still enabled and I can still pick any item on it):
        >
        > var testPassMenu = oMenuBar.getSubmenus()[1];
        > testPassMenu.cfg.disabled = true;
        >
        > What's the right way to do this?
        >
        I use:

        testPassMenu.cfg.setProperty("disabled", true);

        although what you are doing should also work - it does for me.
        Make sure that what you want is the second "Submenu", not the second
        item on the barmenu. Disabling the submenu shows no visible change on
        the bar but the items in the submenu itself will be disabled and
        unselectable.
      • Todd Wells
        I want to clarify what is meant here... I have a menu bar with two menus -- Project and Test Pass, each of which have a number of items on it. I d like to
        Message 3 of 5 , Jun 30, 2008
        • 0 Attachment
          I want to clarify what is meant here... I have a menu bar with two menus -- Project and Test Pass, each of which have a number of items on it.  I'd like to disable Test Pass in some situations, either from it being selected at all or, as an alternative, having any of it's items selected. With the method I was trying, neither was happening.  How can I disable the item on the menubar?

          On Mon, Jun 30, 2008 at 1:35 PM, wally.ritchie <wally.ritchie@...> wrote:

          I use:

          testPassMenu.cfg.setProperty("disabled", true);

          although what you are doing should also work - it does for me.
          Make sure that what you want is the second "Submenu", not the second
          item on the barmenu. Disabling the submenu shows no visible change on
          the bar but the items in the submenu itself will be disabled and
          unselectable.

        • wally.ritchie
          ... menus -- ... I d like ... selected at ... item on ... What you are doing should work. Make sure that you are using the barmenu object for the getSubmenus()
          Message 4 of 5 , Jun 30, 2008
          • 0 Attachment
            --- In ydn-javascript@yahoogroups.com, "Todd Wells" <ttopwells@...> wrote:
            >
            > I want to clarify what is meant here... I have a menu bar with two
            menus --
            > Project and Test Pass, each of which have a number of items on it.
            I'd like
            > to disable Test Pass in some situations, either from it being
            selected at
            > all or, as an alternative, having any of it's items selected. With the
            > method I was trying, neither was happening. How can I disable the
            item on
            > the menubar?
            >
            > On Mon, Jun 30, 2008 at 1:35 PM, wally.ritchie <wally.ritchie@...>
            > wrote:
            >
            > > I use:
            > >
            > > testPassMenu.cfg.setProperty("disabled", true);
            > >
            > > although what you are doing should also work - it does for me.
            > > Make sure that what you want is the second "Submenu", not the second
            > > item on the barmenu. Disabling the submenu shows no visible change on
            > > the bar but the items in the submenu itself will be disabled and
            > > unselectable.
            > >
            >
            What you are doing should work. Make sure that you are using the
            barmenu object for the getSubmenus() call and not a menu item. Try an
            alert or firebug to make sure you are working with the right objects.
            The setProperty will add the class "disabled" to a division that is a
            child of the menubaritem containing the submenu.

            It's also possible you have a timing problem. I believe that the menu
            has to be rendered before you can disable it.
          • Todd Wells
            Your method worked where mine didn t (don t know why). On Mon, Jun 30, 2008 at 4:40 PM, wally.ritchie
            Message 5 of 5 , Jun 30, 2008
            • 0 Attachment
              Your method worked where mine didn't (don't know why). 

              On Mon, Jun 30, 2008 at 4:40 PM, wally.ritchie <wally.ritchie@...> wrote:

              --- In ydn-javascript@yahoogroups.com, "Todd Wells" <ttopwells@...> wrote:
              >
              > I want to clarify what is meant here... I have a menu bar with two
              menus --
              > Project and Test Pass, each of which have a number of items on it.
              I'd like
              > to disable Test Pass in some situations, either from it being
              selected at
              > all or, as an alternative, having any of it's items selected. With the
              > method I was trying, neither was happening. How can I disable the
              item on
              > the menubar?
              >
              > On Mon, Jun 30, 2008 at 1:35 PM, wally.ritchie <wally.ritchie@...>

              > wrote:
              >
              > > I use:
              > >
              > > testPassMenu.cfg.setProperty("disabled", true);
              > >
              > > although what you are doing should also work - it does for me.
              > > Make sure that what you want is the second "Submenu", not the second
              > > item on the barmenu. Disabling the submenu shows no visible change on
              > > the bar but the items in the submenu itself will be disabled and
              > > unselectable.
              > >
              >
              What you are doing should work. Make sure that you are using the
              barmenu object for the getSubmenus() call and not a menu item. Try an
              alert or firebug to make sure you are working with the right objects.
              The setProperty will add the class "disabled" to a division that is a
              child of the menubaritem containing the submenu.

              It's also possible you have a timing problem. I believe that the menu
              has to be rendered before you can disable it.


            Your message has been successfully submitted and would be delivered to recipients shortly.