Index

Global Objects

Types


Type Text


Extends Control.
RWT Scripting analoge to org.eclipse.swt.widgets.Text

Type Summary
Constructor Attributes Constructor Name and Description
 
Text()
The constructor is not public.
Field Summary
Field Attributes Field Name and Description
 
Instance of $ wrapping the widgets HTML input element.
Fields borrowed from class Widget:
$el
Method Summary
Method Attributes Method Name and Description
 
Returns the editable state.
 
Returns an array whose first value is the character position representing the start of the selected text, and whose second value is the character position representing the end of the selection.
 
Returns the widget text.
 
setSelection(selection)
Sets the selection to the range specified by an array whose first value is the character position representing the start of the selected text, and whose second value is the character position representing the end of the selection.
 
setText(text)
Sets the contents of the receiver to the given string.
Methods borrowed from class Control:
addListener, forceFocus, getBackground, getCursor, getEnabled, getForeground, getToolTipText, getVisible, removeListener, setBackground, setEnabled, setForeground, setToolTipText, setVisible
Methods borrowed from class Widget:
getData, setData
Event Summary
Event Attributes Event Name and Description
 
Sent when the widget text is changed
 
Sent before the widget text is changed
Events borrowed from class Control:
FocusIn, FocusOut, Hide, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter, MouseExit, MouseMove, MouseUp, MouseWheel, Paint, Show
Type Detail
Text()
The constructor is not public.
Since:
2.2
Field Detail
$input
Instance of $ wrapping the widgets HTML input element.
Method Detail
{boolean} getEditable()
Returns the editable state.
Returns:
{boolean} whether or not the receiver is editable

{int[]} getSelection()
Returns an array whose first value is the character position representing the start of the selected text, and whose second value is the character position representing the end of the selection. An "empty" selection is indicated by the values being identical.

Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.

Returns:
{int[]} array representing the selection start and end

{string} getText()
Returns the widget text.
Returns:
{string} the widget text

setSelection(selection)
Sets the selection to the range specified by an array whose first value is the character position representing the start of the selected text, and whose second value is the character position representing the end of the selection. An "empty" selection is indicated by the values being identical.

Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.

Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N. This differs from other functions that address character position such as getText () that use the usual array indexing rules.

Parameters:
{int[]} selection
array representing the selection start and end

setText(text)
Sets the contents of the receiver to the given string. If the receiver has style SINGLE and the argument contains multiple lines of text, the result of this operation is undefined and may vary from platform to platform.
Parameters:
{string} text
the new text
Event Detail
Modify
Sent when the widget text is changed
Parameters:
{Event} event
See:
SWT.Modify

Verify
Sent before the widget text is changed
Parameters:
{Event} event
See:
SWT.Verify

Copyright (c) EclipseSource and others 2013, 2016. All rights reserved.