• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

popup_menu items

Community Beginner ,
Jul 25, 2017 Jul 25, 2017

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

TOPICS
SDK

Views

427

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 26, 2017 Jul 26, 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.

Votes

Translate

Translate
LEGEND ,
Jul 26, 2017 Jul 26, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 27, 2017 Jul 27, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2017 Jul 27, 2017

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 28, 2017 Jul 28, 2017

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 29, 2017 Jul 29, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines