RichText Events
RichText widget has the following event associated with it:
doLayout Event
This event is invoked for every widget when the widget position and dimensions are computed.
Syntax
Read/Write
Read + Write
Remarks
This event is invoked for all the widgets placed inside flex containers. This event is invoked in the order in which the widgets are added to the widget hierarchy and expect the frame property of the widget is calculated and available for use within this event.
This event is used to set the layout properties of child widgets in the relation to self and peer widgets whose layout is not yet performed.
The number of times this event invoked may vary per platform. It is not recommended to write business logic assuming that this function is invoked only once when there is a change in positional or dimensional properties. This event will not trigger when transformations are applied though widget is moved or scaled or rotated from its original location.
Example
Platform Availability
- iOS
- Android
- Windows
- SPA
onClick Event
An event callback is invoked by the platform when the user performs a click action on the portion of the text only where a link is defined.
Syntax
Parameters
richtextid
Optional. Reference to the RichText widget that raised the event.
linktext
Optional. Specifies the text of the link which you have touched or clicked.
attributes
Optional. Specifies the JSObject containing the attributes of the link. For example, the attribute can contain href as a key and the url as the value.
Read/Write
Read + Write
Remarks
If the link is not defined, then onClick event is not invoked.
When the anchor tag is available and onClick event is not defined, the widget opens all anchor tags in a device browser.
In the onClick event , the attribute does not respect anchor tags in rich client. It is respected only on browser based platforms (Mobile Web, SPA etc).
For example, in the below code when you click “Click here” , the javascript confirm function is not invoked. Only in Mobile Web and SPA it is invoked.
<a href=”#” onclick=confirm(“Do you want to proceed”)>Click here </a>
Example
Platform Availability
- Available in the IDE
- Available on all platforms.
onScrollWidgetPosition Event
This event callback is invoked by the platform when the widget location position gets changed on scrolling. The onScrollWidgetPosition event returns the positional coordinates of the widget’s location with respect to the screen (screenX and screenY) and the parent container (frameX and frameY). This event is invoked asynchronously, and is not available for FlexForm widget.
Syntax
Read/Write
Read + Write
Example
Platform Availability
- Not Accessible from IDE
- Android, iOS, SPA, and Windows
onTouchEnd Event
An event callback is invoked by the platform when the user touch is released from the touch surface.
Syntax
Optional Parameters
source
Handle to the widget reference on which the user touch has ended.
x
Specifies the x-coordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
y
Specifies the y- coordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
contextInfo
On devices that support 3D Touch, specifies a key-value pair where the value specifies the force of the touch. The value 1.0 represents the force of an average touch, as determined by the system.
Note: 3D Touch is available only on iOS 9.0 and later.
Read/Write
Read + Write
Remarks
This event is invoked asynchronously.
Example
Platform Availability
- iOS, Android, Windows, and SPA
onTouchMove Event
An event callback is invoked by the platform when the touch moves on the touch surface continuously until movement ends.
Syntax
Optional Parameters
source
Handle to the widget reference on which touch moves.
x
Specifies the x-coordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
y
Specifies the y- coordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
contextInfo
On devices that support 3D Touch, specifies a key-value pair where the value specifies the force of the touch. The value 1.0 represents the force of an average touch, as determined by the system.
Note: 3D Touch is available only on iOS 9.0 and later.
Read/Write
Read + Write
Remarks
This event is invoked asynchronously.
Example
Platform Availability
- iOS, Android, Windows, and SPA
onTouchStart Event
An event callback is invoked by the platform when the user touches the touch surface.
Syntax
Optional Parameters
source
Handle to the widget reference on which the user touches.
x
Specifies the X co-ordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
y
Specifies the Y co-ordinate with in the widget with respect to widget’s co-ordinate system. It is a number indicating device independent pixel.
contextInfo
On devices that support 3D Touch, specifies a key-value pair where the value specifies the force of the touch. The value 1.0 represents the force of an average touch, as determined by the system.
Note: 3D Touch is available only on iOS 9.0 and later.
Read/Write
Read + Write
Remarks
This event is invoked asynchronously.
Example
Platform Availability
- iOS, Android, Windows, and SPA
postOnclickJS Event
This event allows the developer to execute custom javascript function after the onClick callback of the widget is invoked.
Syntax
Read/Write
Read + Write
Remarks
This is applicable only for Mobile Web channel.The function must exist in a javascript file under project>module>js folder.
Example
Platform Availability
- Available in the IDE
- Available on Server side Mobile Web (Advanced) platform only
preOnclickJS Event
This event allows the developer to execute custom javascript function before the onClick callback of the widget is invoked.
Syntax
Read/Write
Read + Write
Remarks
This is applicable only for Mobile Web channel. The function must exist in a javascript file under project>module>js folder.
In for the events preOnclickJS and postOnclickJS you will not be able to access application model or APIs, as these functions are executed in browser whereas the remaining JS modules are executed in server. For these events you can access browser objects ( window, document etc..) to change UI or perform some validation before server event. If the event preOnclickJS returns true, only then the request is sent to server for subsequent action.
You have to specify the modules to be loaded in browser using import JS tab, only then these files get included in.html script tag otherwise you will not be able to access the objects defined in those modules.
Example
Platform Availability
- Available in the IDE
- Available on Server side Mobile Web (BJS and Advanced) platform only