Adobe 65007312 Programming Guide - Page 102
title = Dialog Example, local contents = f:column
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 102 highlights
CHAPTER 5: Creating a User Interface for Your Plug-in Binding UI values to data values 102 local LrView = import "LrView" -- Create an observable table within a function context. LrFunctionContext.callWithContext( 'bindingExample', function( context ) -- Obtain the view factory. local f = LrView.osFactory() -- Create the observable table. local properties = LrBinding.makePropertyTable( context ) -- Add an observer of the storeValue property. properties:addObserver( 'storeValue', function( properties, key, newValue ) local items = properties.storeItems -- get current items list from this table if items == nil then items = {} end -- Check if current value is already in the list. local inList for i, v in ipairs( items ) do if v == newValue then inList = true break end end -- If not, add it. if not inList then items[ #items + 1 ] = newValue end -- Reset data value with current items list properties.storeItems = items end ) -- Create the view hierarchy for the dialog. local contents = f:column { spacing = f:control_spacing(), bind_to_object = properties, -- bound to the table we created f:combo_box { value = LrView.bind 'storeValue', -- bind to observed key items = LrView.bind 'storeItems', -- bind to data value that the -- observer modifies }, } -- Display the dialog. local result = LrDialogs.presentModalDialog( { title = "Dialog Example", contents = contents, } ) end )