cpr.controls.Control

Abstract class of controls

Index

Properties
Name Type Description
disposed Boolean Returns whether the control should be removed.
id String Returns the ID of the control.
type ControlType Returns the signature string of the Control's unique Type that can distinguish the Control.
uuid String Returns the unique ID of the control.
Methods
Name Return Type Description
addEventListener Add listeners by EventType to the control.
addEventListenerOnce (e: cpr.events.CEvent)=>Void Add a listener to the control that will run only once per EventType.
bind IBindFactory Bind that property.
dispatchEvent Boolean Forwards specific events.
dispose Removes the objects contained in the control.
getAppInstance AppInstance Returns the app instance to which the control belongs.
getBindContext BindContext Returns the bind context.
getBindInfo BindInfo Returns the bind property information for the control.
getUserAttrNames String[] Returns all custom attribute names.
isAvailableBinding Boolean Returns whether the queried property is bindable and the binding has been configured to obtain a valid value.
isBindable Boolean Make sure it is a bindable property.
removeAllEventListeners Removes all event listeners for the control.
removeAllUserAttr Delete all custom attributes.
removeEventListener Remove Listener for each EventType in the control.
removeEventListeners Remove all EventType listeners from the control.
removeUserAttr Removes user-defined attributes for a specific attribute name.
unbind Unbind that property.
userAttr Specifies custom properties.
userData Specifies custom data.
userattr Object Returns a user-defined property.

Properties

disposed
type Boolean
readonly
Returns whether the control should be removed.
id
type String
readonly
Returns the ID of the control.
type
type ControlType
readonly
Returns the signature string of the Control's unique Type that can distinguish the Control. Please refer to ControlType for available constant values. For UDC controls, each unique type name is returned. Example: udc.MyUDC
uuid
type String
readonly
Returns the unique ID of the control.

Methods

addEventListener(type, listener)
Add listeners by EventType to the control.
Add a listener to the control to handle when a specific event occurs.
var button = new cpr.controls.Button("btn01");
button.addEventListener("click", function(e) {
// event code...
});
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
addEventListenerOnce(type, listener)
Add a listener to the control that will run only once per EventType.
Add a listener to the control to handle when a specific event occurs. The added listener is automatically deleted after running once. Since the object of the added listener is changed, when the listener is deleted It is an object returned after calling addEventListenerOnce and can be deleted.
var button = new cpr.controls.Button("btn01");
button.addEventListenerOnce("click", function(e) {
// event code...
});
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
return (e: cpr.events.CEvent)=>Void The modified Listener object.
bind(propertyName)
Bind that property.
Parameters
name type description
propertyName #bindable-property_name The attribute name to bind.
return IBindFactory Factory showing bind type.
dispatchEvent(e)
Forwards specific events.
Parameters
name type description
e CEvent event
return Boolean Successful event delivery.
dispose()
Removes the objects contained in the control.
getAppInstance()
Returns the app instance to which the control belongs.
return AppInstance The app instance the control belongs to.
getBindContext()
Returns the bind context.
return BindContext bind context
getBindInfo(propertyName)
Returns the bind property information for the control.
Parameters
name type description
propertyName #bindable-property_name The name of the attribute being bound.
return BindInfo BindInfo Properties
getUserAttrNames()
Returns all custom attribute names.
return String[] An array of all custom attribute names.
isAvailableBinding(propertyName)
Returns whether the queried property is bindable and the binding has been configured to obtain a valid value. Even if no binding is configured and a simple value is specified, it is treated as configured so that a valid value is obtained. For example, binding to a row index that does not exist in the DataSet is an invalid binding.
Parameters
name type description
propertyName #bindable-property_name Property name to check whether binding is valid.
return Boolean
isBindable(propertyName)
Make sure it is a bindable property.
Parameters
name type description
propertyName #bindable-property_name Attribute name
return Boolean Confirmation.
removeAllEventListeners()
Removes all event listeners for the control.
removeAllUserAttr()
Delete all custom attributes.
removeEventListener(type, listener)
Remove Listener for each EventType in the control.
control.removeEventListener ('click', listener);  
Parameters
name type description
type String Event type.
listener (e: cpr.events.CEvent)=>Void Event listeners.
removeEventListeners(type)
Remove all EventType listeners from the control.
control.removeEventListeners ('click');  
Parameters
name type description
type String Event type.
removeUserAttr(key)
Removes user-defined attributes for a specific attribute name.
Parameters
name type description
key String The custom attribute name to remove.
unbind(propertyName)
Unbind that property.
Parameters
name type description
propertyName #bindable-property_name Attribute name to unbind.
userAttr(key, value)
Specifies custom properties.
Parameters
name type description
key String The attribute name to assign
value String The attribute value to specify.
userAttr(key)
Returns a user-defined property.
Parameters
name type description
key String The attribute name to get.
return String Custom properties.
userAttr(values)
Specify multiple custom properties at once.
Parameters
name type description
values {[key:string]: String} A JSON object containing custom attribute keys/values.
userAttr()
Get all custom properties in the form of a map.
return {[key:string]: String}
userData(key, value)
Specifies custom data. Unlike user-defined attributes, you can use arbitrary types in addition to strings. When the control is dispose, all custom data is removed.
Parameters
name type description
key String The key of the data to be specified.
value Object Data to specify.
userData(key)
get custom data
Parameters
name type description
key String The key of the data to get.
return Object
userData(override)
Specifies multiple user-defined data.
Parameters
name type description
override {[key:string]: Object} A JSON object containing user-defined data.
userData()
Get all your custom data.
return {[key:string]: Object}
userattr()
deprecatedPlease use userAttr.
Returns a user-defined property.
return Object Custom properties.