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.
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:
forceFocus, getBackground, getCursor, getData, getEnabled, getForeground, getToolTipText, getVisible, setBackground, setData, setEnabled, setForeground, setToolTipText, setVisible
Type Detail
Text()
The constructor is not public.
Since:
2.2
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

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