Adobe 65007312 Programming Guide - Page 178
Run the plug-in, becomes the result of the binding, and thus
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 178 highlights
CHAPTER 9: Getting Started: A Tutorial Example Binding to multiple keys 178 f:edit_field { -- add multi-key value binding later value = LrView.bind { keys = { -- specify the two bound keys { key = "sliderOne" -- in default table }, { key = "sliderTwo", bind_to_object = tableTwo - specify a different table } }, -- add operation }), 9. You must also supply the function that operates on the multiple key values to supply a single result for the binding. In this case, we will simply add the two numeric values, and return the result: -- add operation operation = function( binding, values, fromTable ) return values.sliderTwo + values.sliderOne end }, Notice how you use the values argument passed to this function to access the value of each bound key. Whenever one of the key values changes, this function is automatically invoked; the return value becomes the result of the binding, and thus the value of the edit box. 10. Use LrDialogs.presentModalDialog() to display the new custom dialog, and call it when the script is run: local result = LrDialogs.presentModalDialog { title = "Custom Dialog Multiple Bind", contents = c, -- the view hierarchy we defined } MyHWLibraryItem.showCustomDialogWithMultipleBind() 11. Save your changes to the file. Run the plug-in Use these steps to run the plug-in and text the dialog: 1. Reload the plug-in, as described in step 1 on page 172. 2. Choose Library > Plug-in Extras > Hello World Custom Dialog to show the custom modal dialog created by the LibraryMenuItem.lua script: