Lightroom SDK: LrDialogs.presentModalDialog - actionBinding is broken

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
LrDialogs.presentModalDialog - actionVerb works fine, but actionBinding is ignored.

for example, if I write:

local args = {}
args.actionVerb = "Test"
args.actionBinding = 'test'
accItems[#accItems + 1] =
vf:push_button {
title = str:fmt( "Doesntmatter" ),
action = function( button )
LrDialogs.stopModalWithResult( button, 'whocares' )
end
}
end
args.contents = vf:column( mainItems ) - main-items not relevant.
args.accessoryView = vf:row( accItems )
args.save_frame = 'testPrompt'

local answer = LrDialogs.presentModalDialog( args )

then click the 'Test' button, the value returned in answer will be 'ok' - I expect it to be 'test'.

Is it broken? or am I using it incorrectly???
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 385 Reply Likes

Posted 7 years ago

  • 1
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 385 Reply Likes
Still broken in Lr5.6 (or in any case, I can't figure out how to use it).

Suggestion: either clarify the documentation, fix the feature, or remove..

Excerpt from current doc:
----------------------------------
actionVerb: (string, optional) The localizable label of the action button; default "OK".
actionBinding: (string or table, optional) A unique return value for the action button.
Photo of Rory Hill

Rory Hill

  • 242 Posts
  • 35 Reply Likes
I sometimes marvel that you persevere Rob :*)
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 385 Reply Likes
Hi Rory - that was a very nice way to put it - thanks.
Alternate wording: that you keep banging your head against a wall that you know won't budge ;-}.
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
Yes, that documentation is flat out wrong. The 'actionBinding' parameter actually gives you access to the button's view binding properties (to allow you to do things like enable or disable the button.)

This property should be removed from the documentation. Bug filed.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 385 Reply Likes
Thanks for the info Paul.

|> "The 'actionBinding' parameter actually gives you access to the button's view binding properties (to allow you to do things like enable or disable the button.)"

That sounds worthwhile, could you supply an example? (and maybe redocument instead of removing?).
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
We've documented this properly in the current SDK.

Example:


local props = import 'LrBinding'.makePropertyTable( context )


LrDialogs.presentModalDialog {
contents = f:row {
f:static_text {
title = 'text'
}
},
actionBinding = {
enabled = {
bind_to_object = props,
key = 'actionEnabled'
}
}
}
(Edited)