Lightroom SDK: What is the binder and value format and purpose, in operation function (multikey LrView.bind).

  • 1
  • Question
  • Updated 5 years ago
From the doc:

LrView.bind( binding )
This namespace function declares a binding to a data value in a property table.

First supported in version 1.3 of the Lightroom SDK.
Parameters

1. binding
(string or table) The data property. The name of a key in the default bound table, or, to specify a single property, a table with these entries:

key (string) A key name for the observed property.
bind_to_object (string) Optional. The name of an observable table containing this key, which overrides the current bound table.
transform (function) Optional. A function that changes the value whose modification triggered the notification. Function looks like: myTransform( value, fromModel ) returns result. The value parameter is the value about to be set into the view if fromModel is true. The value parameter is the value coming from the view if fromModel is false.

To specify multiple properties, a table with these entries:

keys (table) Multiple observed properties. Entries can be simple key names from the bound table, or you can specify a key in another table, using a key-value pair, in which the value part can be a table with these items:
key (string) A property name
bind_to_object (string) Optional. The name of an observable table containing this key, which overrides the current bound table.
unique_key (string) Optional. A unique name with which to identify this key, if the actual name is also used in another table.
bind_to_object (string) Optional. The name of an observable table containing these keys, which overrides the current bound table, but is overridden by specific key specifications.
operation (function) Required. A function defining an operation to perform on the key values; the result of this operation is passed to the transform function. Function looks like: myOperation( binder, value, fromModel ).
transform (function) Optional. A function that changes the value whose modification triggered the notification. Function looks like: myTransform( value, fromModel ) returns result. The value parameter is the value about to be set into the view if fromModel is true. The value parameter is the value coming from the view if fromModel is false.

More specifically, in this part:

operation (function) Required. A function defining an operation to perform on the key values; the result of this operation is passed to the transform function. Function looks like: myOperation( binder, value, fromModel ).

what exactly is this binder, and the value?

I've dumped using John Ellis' debug function, but I can't figure a way to access anything useful from these parameters, nor can I figure out anything to do with them, nor what purpose they serve in being passed in...

?

Note: in the transform function, the value makes sense: it is the value in the subject property table indexed by specified key, however in the operation function it's some (as of yet, seemingly) obscure internal table... (ditto for binder)
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 379 Reply Likes
  • confused

Posted 5 years ago

  • 1
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 379 Reply Likes
Nobody knows?