Skip to main content
Participant
July 25, 2017
Answered

popup_menu items

  • July 25, 2017
  • 1 reply
  • 614 views

Hi All,

I want to use an array as my popup_menu items. The Index of my array is coming from a different popup_menu item.

In other words, items of my second popup_menu should be changed according to selected item of the first popup_menu.

I need to use bind 'my_value' as my array index like in below.

f:popup_menu {

          width = 250, -- the shared binding

          height = 180, -- the shared binding

          items = MyArray[bind 'my_value'],

        },

How can I achieve to do this?

Thanks in advance

This topic has been closed for replies.
Correct answer johnrellis

Set "items" to a binding with a transform function that returns MyArray [prop.my_value], where "prop" is the property table for the dialog.  See page 106 of the Lightroom SDK Guide for an example of using a transform function.

1 reply

johnrellis
johnrellisCorrect answer
Legend
July 27, 2017

Set "items" to a binding with a transform function that returns MyArray [prop.my_value], where "prop" is the property table for the dialog.  See page 106 of the Lightroom SDK Guide for an example of using a transform function.

komana909Author
Participant
July 27, 2017

Thank you for the reply. I've done this.

I have one more question. How can I call a function when the textbox or slider change? Now I call a function, only when "button ok" is clicked.

johnrellis
Legend
July 27, 2017
How can I call a function when the textbox or slider change?

There are two ways of doing that. You can use a binding with a transform() function that calls your desired function, or you can add an observer to the value property of the edit_field or slider (see page 184 of the SDK Guide).