Lightroom SDK: simple_list() doesn't scroll to current selection

  • 1
  • Problem
  • Updated 1 year ago
viewFactory:simple_list() doesn't scroll to the currently selected item, making it much less useful. For example, when starting, plugins often want to set the selected item to the one selected the last time the plugin was run.  But simple_list() won't automatically scroll to that item, and users will be fooled into thinking nothing is selected.

Sample script demonstrating the bug:
local LrDialogs = import 'LrDialogs'
local f = import 'LrView'.osFactory()
local items = {}
for i = 1, 24 do items [i] = {title = "Item " .. i, value = i} end
LrDialogs.presentModalDialog {title = "Test", 
    contents = f:simple_list {items = items, value = {20}}} 
Some experimentation shows that the following undocumented call will scroll to the specified row on OS X, but it doesn't do anything on Windows 10:
    _classInfo.scrollRowToVisible (
        simpleList._children[1]._viewAttributes.document_view, i)
Photo of John R. Ellis

John R. Ellis, Champion

  • 3154 Posts
  • 754 Reply Likes

Posted 1 year ago

  • 1

Be the first to post a reply!