Lightroom SDK: combo_box() doesn't work on Windows

  • 3
  • Problem
  • Updated 11 months ago
  • (Edited)
[Update: This is still broken in LR 7.0.1 on Windows. See here for details:
https://feedback.photoshop.com/photoshop_family/topics/lightroom_sdk_combo_box_text_entry_is_broken?...
- John Ellis]

Combo box is supposed to allow selection of list item *or* keyboard text entry - the latter is broken.Broken on Windows for sure - I don't remember whether bug confirmed on Mac or not.At least since Lr3, not sure about Lr2...Test plugin: http://www.robcole.com/_temp/ComboBoxTest.lrdevplugin.zip
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes
  • frowning

Posted 7 years ago

  • 3
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
Hi Rob,

I took a look at this issue and I believe you can resolve it by adding the property "immediate = true" to your combo-box. I tried this in your specific plug-in and it seemed to resolve the issue.

Note, without the "immediate" the value does get set but you are not guaranteed it will be set immediately. You can see this behavior by adding a button that simply displays a message with the combo box value. When you type in an entry manually and hit the button for the first time, the value is usually not set yet. If you hit the button again it always seems to be set.

I agree this behavior is not ideal- it does seem like the default behavior should have "immediate = true" although I have to investigate the performance impact of this change.

-paul
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes
Thanks Paul,

immediate=true will provide a viable work-around for now.

If "unfixed" in next rev, consider at least adding a note to the SDK doc.

Good to know,
Rob
Photo of John R. Ellis

John R. Ellis, Champion

  • 3792 Posts
  • 992 Reply Likes
I just wasted an hour re-discovering this bug (which I had me-too'ed six years ago, sigh).  

On Windows, text entry into a viewFactor:combo_box() fails unless the property "immediate = true" is provided. To reproduce, run the following script:
local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"
local bind = LrView.bind
local f = LrView.osFactory()
LrFunctionContext.callWithContext ("", function (context)
    local prop = LrBinding.makePropertyTable (context)
    local controls = f:column {bind_to_object = prop,
        f:combo_box {value = bind ("valueFalse"), immediate = false},
        f:combo_box {value = bind ("valueTrue"), immediate = true}}
    local result = LrDialogs.presentModalDialog {
        title = "combo_box bug", contents = controls}
    LrDialogs.message (string.format ("immediate = false: '%s'\n" ..
        "immediate = true: '%s'", prop.valueFalse, prop.valueTrue))
   end)
Enter "xxx" in the first combo box and "yyy" in the second box.  On Mac, the script executes correctly and produces:


But on Windows, the script produces the following incorrect results: