Difference between revisions of "LGUI2:Data Bindings"

From Lavish Software Wiki
Jump to navigation Jump to search
(Created page with "LavishGUI 2 Data Bindings provide a way to bind certain LavishGUI 2 values, such as the text in a text box, to LavishScript values. == Defining a ...")
(No difference)

Revision as of 15:26, 1 September 2019

LavishGUI 2 Data Bindings provide a way to bind certain LavishGUI 2 values, such as the text in a text box, to LavishScript values.

Defining a Data Binding

A Data Binding is defined either by a JSON object enclosed by {}, or by a string.

As a JSON Object

Data Binding properties
pullFormat A LavishScript Data Sequence that retrieves the desired value, e.g. ${MyObject.MyValue}
pullReplaceNull A string to replace a "NULL" pulled value
pushFormat An Array of 2 strings that, with the value in-between, form a command to update the desired value, e.g. [ "MyObject.MyValue:Set[\"", "\"]" ] may form MyObject.MyValue:Set["new value"]
pushNullFormat A string with the command to update the desired value, if it would otherwise update to NULL
autoPull A boolean specifying whether Pull should be done automatically on demand. Default is true
autoPush A boolean specifying whether Push should be done automatically on demand. Default is true
pullOnce A boolean specifying whether Pull should only be done automatically once (e.g. to initialize the value), and then disable autoPull
bufferSize An integer specifying the maximum length for the string returned by LavishScript. Default is 4096

As a String

For simple cases, Data Bindings can be defined as a single string. The string must be a LavishScript object path (Data Sequence without the containing ${}), from which the Data Binding can automatically build the most common Pull and Push settings from. The object is assumed to have a Set method, and the Data Binding will have no special handling for NULL.

For example, given the string MyObject.MyValue, the following will be used:

  • "pullFormat": "${MyObject.MyValue}"
  • "pushFormat": [ "MyObject.MyValue:Set[\"", "\"]" ]

Examples

LavishGUI 2 Topics