Indicate last-selected menu item

I know this is a niche idea, but here it goes (perhaps for Opus 13+): it would be neat if we could make toolbar menus indicate last-selected items. Use case example for this would be when I select an internet radio shortcut I could easily see which one it was or in any other menu users could easily find where they left off (especially for large menus). The indicator could be persistent during Opus' runtime only, per-lister. The option could be a "Highlight last selection" checkbox in the menu's Command Editor (disabled by default).

For the radio part, it could be done already using variables and @set / @toggle.

1 Like

I've managed to make it work partially: the activated items stay toggled on, but there doesn't seem to be a way to reset the toggle state of non-selected items back to off so that only the last selected item is toggled exclusively?

The crux of the problem seems to be that the @if doesn't support testing for specific values (even though the @set -- or @set glob in my case -- allows for assigning values to variables).

Testing for true/false should work, e.g. @ifset:$glob:MyVar.

Unfortunately true/false doesn't seem to be sufficient to implement desired behaviour:

  • select Item4 > Item4 becomes toggled ON (and any previously toggled item becomes toggled OFF)
  • select Item6 > Item6 becomes toggled ON and Item4 becomes toggled OFF
  • select Item8 > Item8 becomes toggled ON and Item6 becomes toggled OFF
  • etc.

In order for that to work, each menu subitem must have a (n being for example 4 in the first point of the example):
@set glob:LastSelectedItem=n
which of course by itself is supported by the @set, but also each menu subitem must have its number check like so: @toggle:if $glob:LastSelectedItem==n, and this is where the roadblock is...

Non-boolean value comparison like ==n (such as ==4) is not supported for @if, and I don't see any way to implement it without it (or without some kind of a "toggle all off" command at least).

At the moment you'd need a variable for each button, and each button would need to clear all the other buttons' variables and set its own.

(You could make a User Command or Script Command to help there, where it'd be called once from each button, and take the button ID as an argument.)

Yup, each button would need to know (and have hardcoded) IDs of every other button, so that's a no go (too many buttons to maintain) :smiley:

Interesting approach, I'll probably do either this or as you've suggested elsewhere make a script dialog (with List View and bells & whistles).

Thanks!