Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Senior Member Aesculus's Avatar
    Join Date
    Jan 2008
    Posts
    433

    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

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,587

    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?

  3. #3
    Senior Member Aesculus's Avatar
    Join Date
    Jan 2008
    Posts
    433
    Quote 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 at 09:54.
    Chris

  4. #4
    Senior Member Aesculus's Avatar
    Join Date
    Jan 2008
    Posts
    433
    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

  5. #5
    Senior Member Aesculus's Avatar
    Join Date
    Jan 2008
    Posts
    433
    Well perhaps my goal of changing the text color is not achievable?

    https://forums.slimdevices.com/showt...ont#post830111
    Chris

  6. #6
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,587
    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)

  7. #7
    Senior Member Aesculus's Avatar
    Join Date
    Jan 2008
    Posts
    433
    Quote 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.

    Name:  temp.jpg
Views: 29
Size:  38.1 KB
    Chris

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •