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

  • 1
  • Problem
  • Updated 2 years 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

  • 4002 Posts
  • 1055 Reply Likes

Posted 2 years ago

  • 1

Be the first to post a reply!