pp108 : Check

Check

The Check control functions as a switch between two possible data values such as Yes or No and True or False. Check controls are either data-bound or free-form controls. When data-bound, a Check control is bound to a model from which it fetches data. You can use a free-form Check control to display any arbitrary data.

Properties, Events, and Methods of the Control

The properties, events, and methods associated with the Check control define its behavior. You can set them either through the control's property sheet or programmatically using the APIs.

Table 1. List of Properties

Design-time property

Runtime property

Description

ID

id

Sets the string that identifies the control on an XForm. If not specified, a unique ID is automatically generated.

Tab Index

tabIndex

Sets and retrieves the position of the current control in the tabbing order for the current XForm.

Model

Sets the ID of the data model from which the data (specified using the Reference property) is displayed in the control. If model is not specified, it is inherited from the parent control's model.

Reference (xql)

Sets the location or expression for the XPath that contains the data (value) displayed in the control. The XPath refers to the child node or descendants of the immediate parent control's reference.

Class Name

className

Sets or retrieves the class name applied on the control.

Tooltip

title

Sets the tool tip that appears on a control when the mouse is moved over it. Programmatically, this property is set by specifying the title property of the control.

Task Part

Creates a task part for the control. Selecting the check box, displays the Task Part pane.

Data Value

Sets the values which the checked and unchecked states of the check control represents. The possible values set through this are True Value and False Value which represents the checked and unchecked states respectively. By default, True Value is 1 and False Value is 0.

businessObject

Retrieves the root node of the XML data associated with the control; the location of the data is specified by the Reference property.

currentContext

Retrieves the immediate parent of the data that the control represents. This data is the child node of the business object.

data

Retrieves the XML node of the data (value) that the control represents. The location (XPath) of this XML inside the business object is set through the Reference property.


Table 2. List of Events

Event

Description

Change

This event is activated on modifying data in the control, after the Validate event has been fired.

Data Bind

This event is activated before the data is bound to the control.

InFocus

This event is activated when you highlight or focus upon the control.

OutFocus

This event is activated when the control loses its focus.

Validate

This event is activated after the value of the control is changed and the new value is successfully validated against the settings specified in the Formating Options dialog box.


Table 3. List of Methods

Method

Description

addListener()

This method registers the control to receive notifications for an event.

create()

This method is available for data-bound controls only. It creates an instance of the business object for the control.

disable()

This method disables the control on which it is invoked.

enable()

This method enables the control on which it is invoked.

getBusinessObject()

This method retrieves data or business object.

getEBIValidate()

This method retrieves the value that indicates whether a validate request was sent to the Cordys WS-AppServer when the data in the control was changed.

getLabel()

This method returns the label object associated with the control. It is available for all controls associated with labels.

getValue()

This method returns the original value of the control, as available in the database.

isEnabled()

This method retrieves the value that denotes whether the control is enabled or not.

rebind(oBusinessObject)

This method is available for all controls bound to a model. This method refreshes the control with data from the business object that is passed as a parameter. If no parameter is passed, the business object of the model's activeTuple node is used and the control is refreshed.

remove()

This method is available only for data-bound controls. It removes the instances marked for deletion.

removeListener()

This method unregisters the control to cease receiving notifications for its events.

setEBIValidate()

This method sets the value that indicates whether a validate request must be sent to the Cordys WS-AppServer when the data in the control changes.

setLabel(sText)

This method sets the text that is passed as a parameter to the label object associated with the control. It is available for all controls associated with a label.

setValue(sValue)

This method sets the value of the control. The sValue parameter denotes the value to be set for the control.