Skip to main content
Inspiring
March 19, 2024
Answered

Can I use an observer to change a dropdown list

  • March 19, 2024
  • 1 reply
  • 111 views

I have an json file with exiftool information for several images.

Now I choose the file with a browse button and fill the needed image number manually.

I was wondering if it's possible, with an observer:

when the file is choosen can I then update the dropdown list with new values ? 

 

The idea is to populate the dropdown list with values (image numbers)  from the choosen file.

This topic has been closed for replies.
Correct answer johnrellis

You don't need an observer to do this -- just use bound values.  The popup menu is defined as:

f:popup_menu {value = bind "selected", items = bind "items"}

 

The code that selects and reads the file:

local paths = LrDialogs.runOpenPanel {...}
...read the JSON file...
...construct the array of items for the popup...
prop.items = items

1 reply

johnrellis
johnrellisCorrect answer
Legend
March 19, 2024

You don't need an observer to do this -- just use bound values.  The popup menu is defined as:

f:popup_menu {value = bind "selected", items = bind "items"}

 

The code that selects and reads the file:

local paths = LrDialogs.runOpenPanel {...}
...read the JSON file...
...construct the array of items for the popup...
prop.items = items