Command: ScrollSelectionIntoView

ScrollSelectionIntoView - A small script command to automatically scroll the file display to the current selection.
I use it when toggling between details and thumbnails mode to keep the selected items visible. It won't do anything if nothing is selected.

(n.b. Opus 12 does this automatically. This was written for Opus 11. --Leo)

You may add it to your view-toggle button as I did or put it in a new button to have this separately available. It is nice for buttons where you set a show- or quickfilter as well, I somehow can't do without it anymore. o)

My view toggle button using this command looks like this:

Set VIEW=Thumbnails
Set VIEW=Details

To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that create a separate button calling "ScrollSelectionIntoView" or edit existing view changing buttons and menues, to call it directly after any "Set VIEW.." command.


cya! o)

1 Like

Nice work! Thank you very much!

Updated to v1.1

  • supports checkbox mode now as well (but regular selection has priority by default)
  • new parameter/config switch to priorize checkboxmode (defaults to false)
  • new debug output config switch

The command will disable checkbox mode temporarily (if not priorized by switch), to check for selections in regular mode to scroll for.
If a regular selection is not present, it will try to scroll to first selected checkbox item. No selections get lost during this process of course.

Thanks TBone. Very useful. I have added a ScrollSelectionIntoView button to my Images toolbar.

Regards, AB

Updated to v1.2

  • use of tab.stats to detect checkboxed and regular selection, which avoids a lot of extra checkbox toggles
  • commandline param PRIOCHECKBOXSELECTION added

This version is smaller and more efficient than the previous one, it avoids unnecessary flickering if there are no checkbox items selected, so it's smoother in most cases.
In the meantime I added this command to buttons that change the sort order as well and I like it more than ever! o)
It's just so very convenient to be able to toggle between "named" or "creation date" sort order, while your currently selected item stays visible all the time.

You're welcome, thanks for giving feedback! o)