Adobe 65007312 Programming Guide - Page 112
Changing the contents of a view dynamically
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 112 highlights
CHAPTER 5: Creating a User Interface for Your Plug-in Determining layout 112 spacing = f:label_spacing(), f:static_text { title = "Occupation:", alignment = "right", width = LrView.share "label_width", -- the shared binding }, f:edit_field { width_in_chars = 20, }, }, } local result = LrDialogs.presentModalDialog( -- invoke the dialog { title = "Dialog Example", contents = contents, } ) end ) Changing the contents of a view dynamically This simple example of dynamic layout shows one set of controls and hides another set, based on the selected value in a pop-up menu. The dialog contains the popup and three views, each containing an alternate set of controls. When the user makes a selection in the pop-up menu, one of the views is shown, and the other two are hidden. For example: This technique makes use of the overlapping placement style, and demonstrates binding of a property in one node to a property in another, so that changing one also changes the other. The overlapping value for the place property causes all of the children of a node to be placed in the same space. The parent views are made big enough to enclose the largest child in any view, and all of the children are placed within that space. If all of the children were visible at the same time, they would display on top of one another. To make sure only one view is visible at a time, we bind the visible value of each alternative view to a unique value of the pop-up menu. When the user makes the selection that has this value, the view bound to that value is shown, and the other views (bound to different values) are hidden. X You only need to set the visibility of the parent view; when the parent is hidden, all of its child nodes are also hidden, regardless of their individual visibility settings. X The LrBindings.whenKeyEquals() function sets visible to true only when the specified value of the bound property is set. You could choose to bind the true value to, for example, a logical OR or AND of several key values.