Index...
Centrallix Documentation
|
widget/connector
connector :: A nonvisual widget used to trigger an Action on a widget when an Event on another widget fires.
Metadata:
type: | widget/connector |
visual: | no |
container: | no |
form element: | no |
Overview:
Each widget can have events and actions associated with it. The events occur when certain things occur via the user interface, via timers, or even as a result of data being loaded from the server. Actions cause certain things to happen to or within a certain widget, for example causing an HTML layer to reload with a new page, or causing a scrollable area to scroll up or down.
The connector widget allows an event to be linked with an action without actually writing any JavaScript code to do so -- the connector object is created, and given an event to trigger it and an action to perform when it is triggered.
Events and actions can have parameters, which specify more information about the occurrence of an event, or which specify more information about how to perform the action. Such parameters from events can be linked into parameters for actions via the connector widget as well.
When supplying a parameter to a connector (other than "action", "event", and "target"), there are several ways that parameter can be specified. First the parameter can be a constant value, defined explicitly in the application. Second, the parameter can be an expression which is evaluated on the client (using the runclient() pseudo-function) and which can change based on the conditions under which the connector is triggered. In this latter case, the runclient() expression can contain parameters supplied by the event, or values supplied by other widgets.
Usage:
The connector object should be a sub-object of the widget which will trigger the event. Any widget with events can contain connectors as subwidgets.More than one connector may be attached to another widget's event.
An example connector would link the click of a URL in a treeview with the loading of a new page in an HTML area. See the Example source code at the end of this document to see how this is done.
Properties:
Property | Type | Description |
action |
string |
The name of the action which will be activated on another widget on the page. |
event |
string |
The name of the event that this connector will act on. |
event_condition |
integer |
(optional) specifies a runclient() expression indicating the conditions under which the connector will be triggered. |
event_confirm |
string |
(optional) specifies a string or runclient() expression that will be presented to the user in an "OK/Cancel" message box allowing the user to OK or Cancel the triggering of the connector. |
event_cancel |
integer |
(optional) specifies a runclient() expression indicating whether the connector (and the operation generating the event, if it is cancelable), and further connectors on this event, should be canceled. |
event_delay |
integer |
(optional) specifies an integer or runclient() expression indicating that the action should be triggered on the target after a delay of N milliseconds. |
event_all_params |
integer |
(optional) specifies an integer or runclient() expression indicating that all of the parameters generated by the event should be passed as parameters to the action. Particularly useful when "relaying" an action on a component-decl to another action inside the component-decl, as the individual parameters don't need to be listed separately. |
source |
string |
The name of the widget generating the event (defaults to the widget the connector is placed inside of). |
target |
string |
The name of another widget on the page whose action will be called by this connector (if unspecified, defaults to the widget the connector is placed inside of). |
Sample Code:
$Version=2$
// Here's our connector. Imagine that this is embedded within a treeview
// and references an 'html' control called 'ht1' somewhere else on the page.
//
cn1 "widget/connector"
{
// Triggered by ClickItem from the treeview.
event = "ClickItem";
// Causes the LoadPage action on html area 'ht1'
target = "ht1";
action = "LoadPage";
// The Source for LoadPage is the Pathname from ClickItem.
Source = runclient(:Pathname);
}
Comments...
Greg on 2014-Dec-29 16:53 | Hi Tumbler, the events vary based on the source of the event; most of them are listed here with each widget that generates events, but a handful of them need to be updated.
| Tumbler on 2014-Dec-18 15:42 | Could you actually list the different type of events that can be given to the "event" property? (or at least link to a page that does?)
|
Add a Comment...
|