Adobe 65007312 Programming Guide - Page 171
Create UI elements, container, and it is bound to the observable data table that we created in step
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 171 highlights
CHAPTER 9: Getting Started: A Tutorial Example Displaying a custom dialog 171 5. Add a key to the observable table called isChecked: -- body of called function local props = LrBinding.makePropertyTable( context ) -- create bound table props.isChecked = false -- add a property key and initial value -- create view hierarchy Create UI elements The Lightroom SDK also provides the LrView class and namespace which allows you to create custom dialog elements. You need to populate the custom dialog with a view hierarchy that defines the custom-UI portion of the dialog. We imported the LrView namespace with the import() function. Now we will use the namespace function LrView.osFactory() to obtain a view-factory object, then use that object to create the UI elements. 6. Add code to obtain a view-factory object: -- create view hierarchy local f = LrView.osFactory() 7. The variable c will hold the view hierarchy that defines the dialog contents. The root node is a row container, and it is bound to the observable data table that we created in step 4 above. All of the child nodes inherit this binding, so that they can easily reflect and set data values in this table. Add this code: local f = LrView.osFactory() local c = f:row { -- the root node bind_to_object = props, -- bound to our data table -- add controls 8. Add a checkbox control as a child of the row, and bind it to the isChecked property we created in step 5: -- add controls f:checkbox { title = "Enable", -- label text value = LrView.bind( "isChecked" ) -- bind button state to data key }, 9. Create an editable text field, setting the value to some arbitrary text. This field will only be enabled when the checkbox is checked: f:edit_field { value = "Some Text", enabled = LrView.bind( "isChecked" ) -- bind state to same key }, }