Announcement

Collapse
No announcement yet.

Setting Disabled State on Menu Item

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Setting Disabled State on Menu Item

    > I would like to know how I can toggle the state of the menu item between
    > disabled and normal.


    On the fly? I don't know. What's the UX you're trying to achieve?
    Chris

    #2
    Setting Disabled State on Menu Item

    I am creating plugin menu items like:

    push @menu, {
    text => $client->string('PLUGIN_DENONAVPCONTROL_AUDIO4'),
    id => 'nightmode',
    "icon" => $dynamicVolIcon,
    actions => {
    go => {
    player => 0,
    cmd => [ 'avpNM' ],
    params => {
    menu => 'avpNM',
    },
    },
    },
    };

    I would like to know how I can toggle the state of the menu item between disabled and normal.
    Chris

    Comment


      #3
      Originally posted by mherger View Post
      > I would like to know how I can toggle the state of the menu item between
      > disabled and normal.


      On the fly? I don't know. What's the UX you're trying to achieve?
      This is in my plugin - DenonAvpControl that shows up in apps like iPeng and Squeezer but also on the Touch screen.

      I have some related features that only work when a certain setting is turned on. Formally I did not show that menu item but that is sort of confusing (even for myself) and felt it would be better if it was just disabled but still appeared during these conditions.

      In PERL I have seen mention of "disabled" and "normal" states for menu items, but I was uncertain if this was just a particular UI tool or in general. It was the "state" feature of a menu item.
      Last edited by Aesculus; 2021-04-16, 18:54.
      Chris

      Comment


        #4
        Well it turns out that just eliminating the "do=>" in actions will create a disabled menu item. The downside is that the state is not visible to the user.

        So now I need to find a way to "gray out" the text for an menu item that has no "do" action.

        EDIT: Perhaps removing the "action" area is probably the same. I'll try that.
        Chris

        Comment


          #5
          Well perhaps my goal of changing the text color is not achievable?

          Chris

          Comment


            #6
            Such a change is unlikely going to happen. Maybe if you describe your use case we can find some kind of workaround?
            Michael

            "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
            (LMS: Settings/Information)

            Comment


              #7
              Originally posted by mherger View Post
              Such a change is unlikely going to happen. Maybe if you describe your use case we can find some kind of workaround?
              The use case is that in some conditions some menu items depend on others higher in the list. For example I have a dynamic equalizer setting that can be on or off in one menu. In another menu the user can adjust the reference level offset of the amplifier, but only if they had pre selected the dynamic equalizer as on.

              So I don't want to get rid of the reference level menu because it would come and go and confuse the user. So I detect the state of the dynamic equalizer when building (or rebuilding) the reference level menu. If I find the Dyn Eq off I just leave the Action section off of the menu items. This makes them do nothing when pressed which is good and the way it should be. But they still LOOK like they should react. They are not grayed out like you would expect disabled options to be.

              The Squeezer guy implemented the disabled look in his client if he sees a menu item without an action.

              Click image for larger version

Name:	temp.jpg
Views:	1
Size:	38.1 KB
ID:	1572087
              Chris

              Comment

              Working...
              X