Skip to content

TextBox Events

The TextBox widget has the following events associated with it:


doLayout Event


This event is invoked for every widget when the widget position and dimensions are computed.

Syntax


doLayout()

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


//Sample code to set doLayout event callback to a button widget.
/*This code changes the top property of button2 and makes it appear below button1.*/
myForm.button1.doLayout=doLayoutButton1;


function doLayoutButton1(){

    myForm.button2.top = myForm.button1.frame.height;
}

Platform Availability

  • iOS, Android, Windows, and SPA

onBackKeyPress Event



This is event callback is invoked by the Android platform when the soft- keyboard is open and the back button of the device is clicked.

This event is not be triggered when you use gestures in the mobile device for back navigation.

Syntax


onBackKeyPress()

Read/Write

Read + Write

Example


/*This event is triggered in both TextBox and TextArea widgets for Android platform.*/

/*This example demonstrates how to assign callback to onBackKeyPress event myTxtBox TextBox widget in frmTextBox FlexForm. Use the onBackKeyPress event in TextArea widget in a similar manner.*/
frmTextBox.myTxtBox.onBackKeyPress= onBackKeyPressCallback;

function onBackKeyPressCallback(wdgRef) {
 // handle the event here
 // wdgRef returns the handle of the widget.
}

Platform Availability

  • Android

onBeginEditing Event


This is an event callback that is invoked by the platform when the user clicks within the TextBox and is about to start editing.

Syntax


onBeginEditing()

Read/Write

Read + Write

Example


//Sample code to set the onBeginEditing event callback to a TextBox widget.

frmTxtBox.myTxtBox.onBeginEditing =onBeginEditingCallback;

function onBeginEditingCallback(txtBox){
      //Write your logic here.
}

Platform Availability

  • Available in the IDE
  • iOS, Android, and Desktop Web

onCancel Event


This event is a callback that is invoked by the platform then the user performs a click action on the Cancel button.

Syntax


onCancel()

Read/Write

Read + Write

Remarks

This event is triggered only when the viewType is set as TEXTBOX_VIEW_TYPE_SEARCH_VIEW.

Example


//Sample code to set the onCancel event callback to a TextBox widget.

frmTxtBox.myTxtBox.onCancel=onCancelCallback;

function onCancelCallback(eventobject){
      //Write your logic here.
}

Availability

  • iOS

onDone Event


This event is a callback that is invoked by the platform then the user performs a click action on the Go or Enter button.

Syntax


onDone()

Read/Write

Read + Write

Remarks

In Desktop Web platform, this event is fired when the enter key is pressed when the textbox has focus.

Example


//Sample code to set the onDone event callback to a TextBox widget.

frmTxtBox.myTxtBox.onDone=onDoneCallback;

function onDoneCallback(txtBox){
      //Write your logic here.
}

Availability

  • Available in the IDE
  • Available on all platforms.

onEndEditing Event


This is an event callback that is invoked by the platform.

Syntax


onEndEditing()

Read/Write

Read + Write

Remarks

When the user performs one of the below actions:

  • Click on any other focusable widget(for example, another TextBox)
  • Click on the Done button on the Next Previous bar.
  • Click on the Done button on the keypad.

When you click on the Done button of the keypad the following events take place in a sequence: