A Java interface that can be used to customize the
mapping between a component state and setting values. When a bound control
implements this interface, update
and initComponent
will call the fromSetting
and toSetting
methods provided
by the control instead of the default controlToSetting
and
settingToControl
methods provided by the binding class.
As an example of when this would be useful, consider the case where you
have a combo box of different options, and you want those options to be
localized into the game language. The default binding class will use the string
value of the selected option, so if a component is created in one language,
saved, and opened in another language, the value saved with the component
won't match any of the available options (since it is written in the original
language). Using SettingBackedControl
, you could map each label to
a number or other neutral identifer instead. (If the list of
options is fixed, you could use IndexedComboBoxBinding
for this
purpose.)
uibindings library
Script classes to create bindings between user interface (UI) controls and the private settings on components. Bindings automate the details of synchronizing the state of the user interface controls with the state of an edited game component. When the user manipulates a bound control, the new state is converted into a setting string value and written to the component. When the component is loaded into an editor that uses bound controls, the bound controls will be set to match the setting value in the component.
Include this library by adding
useLibrary("uibindings")
(or ui) to your script. See the plug-in authoring kit for examples that use this library.