Widget Bindings

Top  Previous  Next

If widget components form the "body" of the widget, then its "engine" is constructed of bindings. Bindings define relations between widget components and data from server contexts, such as their variables and functions. Every binding is evaluated at different points during widget execution. Evaluation results are used to modify widget components or context data.

note_further-wt

Bindings are described in general under Data Bindings. Please read that topic and the topics it refers to. Only once you've understood the bindings overview, references and expressions will you easily understand this topic.

Every binding has three parts:

Evaluation options, defining WHEN a binding is processed. Processing may occur on widget startup, button click, changes in data model or properties of widget components etc.
Binding expression, defining WHAT is the result of binding processing. A binding expression may refer to different properties of the widget component or to various data from server contexts. It's written in AggreGate Expression Language.
Binding target, defining WHERE to result of evaluation of binding expression will be written, i.e. which property of the GUI component or what context data will be changed. It is a Reference.

Bindings may be viewed, created or edited:

By editing the Bindings property of any widget component in GUI Builder. The bindings table for a particular component includes only bindings involving this component.
By editing the All Bindings property of the root panel. This bindings table include all bindings available for the widget.

note_tip-wt

GUI Builder greatly simplifies creation of bindings. Most bindings may be created using intuitive Drag and Drop operations. Details of this procedure are described here.

Binding Properties

Every binding defined in the widget template has the following parameters:

Target

Binding target is a special type of reference that points to where the evaluation result of binding expression will be written when the binding is processed. Check the binding target section for details.

Expression

This is an AggreGate Expression that is evaluated every time a binding is processed. The evaluation result is stored in the binding target. See Binding Expression for details.

Activator

This is a reference that points to some event or property of a widget that will trigger the processing of the binding. The Activator parameter is available only when On event parameter is enabled. See Binding Activator for details.

On startup

When this parameter is enabled, the binding is processed every time the widget is launched.

On event

When this parameter is enabled and an Activator is specified, the binding is processed whenever there's a changes in the property the activator refers to. If the Activator refers to an event, the binding will be processed when the event fires. If On event is enabled and an Activator is not specified, the binding will be automatically processed: The binding's Expression includes references, pointing to one or more variables. A change in any of these variables will cause the binding to run.

For example, let's take the following binding, and say that no Activator was specified for it:

  Target: users.admin.deviceservers.ds1.devices.thermostat:temperature$temperature  

  Expression: {form/temperatureField:text} + {form/temparatureAdjustmentField:text}

 

This binding has an expression which takes the value from a form field called temperatureField, and adds it to the value of the temperatueAdjustmentField form field. The end result is then written to the Target. Now, since this binding doesn't have an Activator but On event is enabled for it, the binding is processed whenever the user changes one of the form fields specified in the Expression.

Periodically

If this parameter is enabled, the binding will be processed periodically.

Evaluation period

Interval between binding processing sessions. This parameter may be changed only if Periodically is turned on.