Creating Observable Property Tables - Adobe 65007312 - Photoshop Lightroom Programmer's Manual

Mac
Hide thumbs Also See for 65007312 - Photoshop Lightroom:
Table of Contents

Advertisement

C
5: Creating a User Interface for Your Plug-in
HAPTER
Set a Boolean property when a set of Boolean keys are either all true, or when any one is true
(
LrBinding.andAllKeys
keys" on page
For details of the

Creating observable property tables

The Lightroom SDK defines a notification mechanism based on observable tables. When a value changes in
an observable table (such as the export-settings table), all registered observers (typically
are notified. A plug-in uses this mechanism to make UI controls in the plug-in's user interface respond to
changes in data properties.
The
LrView
as observers of the export-settings table that is passed on creation; see
Plug-in Manager" on page
To use export settings in another context, or to define additional program data, use the function
LrBindings.makePropertyTable()
settings or any other program data.
An observable table must be created with a function context, so that Lightroom can clean up the
notifications if anything goes wrong. (See
function context is created using
function-context object to its main function; you pass that object on to your table-creation function. For
example:
LrFunctionContext.callWithContext("showCustomDialog", function( context )
local properties = LrBinding.makePropertyTable( context )
properties.url = "http://www.adobe.com" -- create a settings value
-- add code to take create dialog contents
end)
When you create a new table, it is initially empty. You can explicitly add keys and values, as in the example.
However, it is not necessary to add a key to a table before you reference it in a binding; if it is not yet in the
table, its value is nil. The example in
bound to a key that is not yet in the table. When the control first gets a value, the key is put into the table
with that value.
T
: You can use a naming convention to distinguish program data from persistent export settings (that is,
IP
those specified in the
example, you might use an underscore prefix, "
Adding observers to tables
You can create a general and flexible response to a change in an observable table by adding an observer.
An observer associates a function that you define with a key in the table, so that whenever the key value
changes, the function is called.
To receive notification of changes in the table you create, use this function to register an observer of the
table:
propertyTable:addObserver( key, func )
,
orAllKeys
105.
functions, see the Lightroom SDK API Reference.
LrBinding
objects that define your UI elements in an Export dialog section are automatically registered
32.
LrFunctionContext.callWithContext()
exportPresetFields
); for more information on how this works, see
to create an observable table, and populate it with your own plug-in
"Using function contexts for error handling" on page
"Transforming values" on page 103
table; see
"Remembering user choices" on page
" to indicate a local data property.
_tempUrl,
Binding UI values to data values 97
"Binding multiple
LrView
"Adding custom sections to the
. This passes a
shows how a control's
57). For
objects)
18.) A
is
value

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop lightroom sdk 3.0

Table of Contents