Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
Many thanks for your answer.
As far as I see, we can capture an editbox value only when lost the focus. There is no option for, like in classical development languages, capture the change or
There is no option for, like in classical development languages, capture the change or keypress? Correct?
Copy link to clipboard
Copied
Use the "immediate" property for viewFactory:edit_field() -- then observer and transform functions will be called each time the user types a key. See the API Reference for LrView for details.