Adobe 65007312 Programming Guide - Page 99
Binding radio button selections
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 99 highlights
CHAPTER 5: Creating a User Interface for Your Plug-in Binding UI values to data values 99 f:checkbox { title = "Value will be string", value = bind 'checkbox_state', -- bind to the key value checked_value = 'checked', -- this is the initial state unchecked_value = 'unchecked', -- when the user unchecks the box, -- this becomes the value, and thus -- the bound key value as well. }, f:static_text { fill_horizontal = 1, title = bind 'checkbox_state', -- bound to same key as checkbox value }, }, -- (add radio button container here for example 2) -- (add pop-up container here for example 3) local result = LrDialogs.presentModalDialog( -- invoke the dialog { title = "Binding Buttons Example", contents = contents, } ) end ) Binding radio button selections The user cannot uncheck a radio button; a selected button is deselected only when another button in the group is selected. Simply putting the buttons in the same container does not enforce this usage; to arrange it, bind the value of each button in the set to a different value of the same key. EXAMPLE 2: Add this to the previous code for an example of binding in a set of radio buttons: f:group_box { -- the buttons in this container make a set title = "Radio Buttons", fill_horizontal = 1, spacing = f:control_spacing(), f:radio_button { title = "Value 1", value = bind 'my_value', -- all of the buttons bound to the same key checked_value = 'value_1', }, f:radio_button { title = "Value 2", value = bind 'my_value', checked_value = 'value_2', }, f:radio_button { title = "Value 3", value = bind 'my_value', checked_value = 'value_3', }, f:static_text { fill_horizontal = 1, title = bind 'my_value', }, },