Adobe 65007312 Programming Guide - Page 182
Run the plug-in, to show the predefined modal dialog created
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 182 highlights
CHAPTER 9: Getting Started: A Tutorial Example Adding a data observer 182 button action resets the observed property value to the value entered by the user in the edit box. It also resets the color of the static text to black, so that we will be able to tell whether the observer function fired. Add this code: -- add push button f:push_button { title = "Update", action = function() -- when clicked, reset values in other controls showValue_st.text_color = LrColor( 0, 0, 0 ) -- make text black props.myObservedString = updateField.value -- reset data value -- from current entered value end }, 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", contents = c, -- the view hierarchy we defined } MyHWLibraryItem.showCustomDialogWithObserver() 11. Save your changes to the file. Run the plug-in Use these steps to run the plug-in and see the observer and the button in action: 1. Reload the plug-in, as described in step 1 on page 172. 2. Choose Library > Plug-in Extras > Hello World Dialog to show the predefined modal dialog created by the ExportMenuItem.lua script. 3. Click OK to dismiss the dialog. 4. Choose Library > Plug-in Extras > Hello World Custom Dialog to show the custom modal dialog created by the LibraryMenuItem.lua script: 5. Enter some text into the "New value" field. 6. Click Update. Notice the "Bound value" text changes to whatever text you entered, and the text turns red.