java.lang.Object | +--org.eclipse.swt.widgets.Widget | +--org.eclipse.swt.widgets.Control | +--org.eclipse.swt.widgets.Scrollable | +--org.eclipse.swt.widgets.Text
Safe: Instances of this class are selectable user interface objects that allow the user to enter and modify text.
Note: Only one of the styles MULTI and SINGLE may be specified.
IMPORTANT: This class is not intended to be subclassed.
ACCENTS, accessible, background, drawCount, foreground, handle, hCursor, layoutData, menu, parent, toolTipText
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values
Text(Composite parent,
int style)
void
addModifyListener(ModifyListener listener)
ModifyListener
interface.
void
addSelectionListener(SelectionListener listener)
SelectionListener
interface.
void
addVerifyListener(VerifyListener listener)
VerifyListener
interface.
int
getTextLimit()
int
getTopIndex()
void
removeModifyListener(ModifyListener listener)
void
removeSelectionListener(SelectionListener listener)
void
removeVerifyListener(VerifyListener listener)
void
setTextLimit(int limit)
void
setTopIndex(int index)
computeTrim, createScrollBar, getClientArea, getHorizontalBar, getVerticalBar, releaseWidget, widgetExtStyle, WM_HSCROLL, WM_MOUSEWHEEL, WM_SIZE, WM_VSCROLL, wmScroll
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, checkOrientation, computeSize, computeTabGroup, computeTabList, computeTabRoot, defaultFont, defaultForeground, deregister, destroyWidget, drawBackground, drawBackground, findBrush, findCursor, findMnemonic, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundPixel, getBorderWidth, getBounds, getCodePage, getDisplay, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getParent, getPath, getShell, getSize, getToolTipText, getVisible, hasCursor, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isDisposed, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, pack, pack, redraw, redraw, register, releaseHandle, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, sendKeyEvent, sendMouseEvent, sendMouseEvent, setBackground, setBackgroundPixel, setBounds, setBounds, setCapture, setCursor, setDefaultFont, setEnabled, setFocus, setForeground, setForegroundPixel, setLayoutData, setLocation, setLocation, setMenu, setParent, setRadioFocus, setRadioSelection, setSavedFocus, setSize, setSize, setTabGroupFocus, setTabItemFocus, setToolTipText, setVisible, sort, subclass, toControl, toControl, toDisplay, toDisplay, transferActive, transferFocus, translateAccelerator, translateMnemonic, translateMnemonic, translateTraversal, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, unsubclass, update, update, updateFont, windowProc, WM_ACTIVATE, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_CTLCOLOR, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_ERASEBKGND, WM_GETFONT, WM_GETOBJECT, WM_HELP, WM_HOTKEY, WM_IME_COMPOSITION, WM_INITMENUPOPUP, WM_KEYDOWN, WM_KEYUP, WM_KILLFOCUS, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSELEAVE, WM_MOUSEMOVE, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCHITTEST, WM_NOTIFY, WM_PAINT, WM_PALETTECHANGED, WM_PRINTCLIENT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETFONT, WM_SETREDRAW, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSCOLORCHANGE, WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TIMER, WM_WINDOWPOSCHANGING, wmColorChild, wmDrawChild, wmMeasureChild, wmNotifyChild, wmScrollChild
addDisposeListener, addListener, checkBits, checkParent, checkSubclass, checkWidget, dispose, error, filters, getData, getData, getName, getNameText, getStyle, hooks, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseChild, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs
int tabs
int oldStart
int oldEnd
boolean doubleClick
boolean ignoreVerify
boolean ignoreCharacter
public static final int LIMIT
public static final String DELIMITER
static final int EditProc
static final org.eclipse.swt.internal.win32.TCHAR EditClass
public Text(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int "|" operator) two or more
of those SWT style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent - a composite control which will be the parent of the new instance (cannot be null)style - the style of control to constructSWT.SINGLE,
SWT.MULTI,
SWT.READ_ONLY,
SWT.WRAP,
Widget.checkSubclass(),
Widget.getStyle()int callWindowProc(int msg, int wParam, int lParam)
callWindowProc in class Scrollablevoid createHandle()
createHandle in class Controlpublic void addModifyListener(ModifyListener listener)
ModifyListener
interface.
listener - the listener which should be notifiedModifyListener,
removeModifyListener(org.eclipse.swt.events.ModifyListener)public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected is not called for texts.
widgetDefaultSelected is typically called when ENTER is pressed in a single-line text.
listener - the listener which should be notifiedSelectionListener,
removeSelectionListener(org.eclipse.swt.events.SelectionListener),
SelectionEventpublic void addVerifyListener(VerifyListener listener)
VerifyListener
interface.
listener - the listener which should be notifiedVerifyListener,
removeVerifyListener(org.eclipse.swt.events.VerifyListener)public void append(String string)
The new text is appended to the text at the end of the widget.
string - the string to be appendedstatic int checkStyle(int style)
public void clearSelection()
public Point computeSize(int wHint, int hHint, boolean changed)
computeSize in class ControlwHint - the width hint (can be SWT.DEFAULT)hHint - the height hint (can be SWT.DEFAULT)changed - true if the control's contents have changed, and false otherwise
Layout,
Control.getBorderWidth(),
Control.getBounds(),
Control.getSize(),
Control.pack(),
"computeTrim, getClientArea for controls that implement them"public void copy()
The current selection is copied to the clipboard.
void createWidget()
createWidget in class Scrollablepublic void cut()
The current selection is first copied to the clipboard and then deleted from the widget.
int defaultBackground()
defaultBackground in class Controlpublic int getCaretLineNumber()
The line number of the caret is returned.
public Point getCaretLocation()
The location of the caret is returned.
public int getCaretPosition()
The character position of the caret is returned.
public int getCharCount()
String getClipboardText()
public boolean getDoubleClickEnabled()
The double click flag enables or disables the default action of the text widget when the user double clicks.
public char getEchoChar()
The echo character is the character that is displayed when the user enters text or the text is changed by the programmer.
public boolean getEditable()
public int getLineCount()
public String getLineDelimiter()
public int getLineHeight()
public Point getSelection()
Indexing is zero based. The range of a selection is from 0..N where N is the number of characters in the widget.
public int getSelectionCount()
public String getSelectionText()
public int getTabs()
Tab stop spacing is specified in terms of the space (' ') character. The width of a single tab stop is the pixel width of the spaces.
int getTabWidth(int tabs)
public String getText()
The text for a text widget is the characters in the widget.
public String getText(int start, int end)
Indexing is zero based. The range of a selection is from 0..N-1 where N is the number of characters in the widget.
start - the start of the rangeend - the end of the range
public int getTextLimit()
If this has not been changed by setTextLimit(),
it will be the constant Text.LIMIT.
public int getTopIndex()
This index can change when lines are scrolled or new lines are added or removed.
public int getTopPixel()
The top pixel is the pixel position of the line that is currently at the top of the widget. On some platforms, a text widget can be scrolled by pixels instead of lines so that a partial line is displayed at the top of the widget.
The top pixel changes when the widget is scrolled. The top pixel does not include the widget trimming.
public void insert(String string)
The old selection is replaced with the new text.
string - the stringint mbcsToWcsPos(int mbcsPos)
public void paste()
The selected text is deleted from the widget and new text inserted from the clipboard.
public void removeModifyListener(ModifyListener listener)
listener - the listener which should no longer be notifiedModifyListener,
addModifyListener(org.eclipse.swt.events.ModifyListener)public void removeSelectionListener(SelectionListener listener)
listener - the listener which should be notifiedSelectionListener,
addSelectionListener(org.eclipse.swt.events.SelectionListener)public void removeVerifyListener(VerifyListener listener)
listener - the listener which should be notifiedVerifyListener,
addVerifyListener(org.eclipse.swt.events.VerifyListener)public void selectAll()
boolean sendKeyEvent(int type, int msg, int wParam, int lParam, Event event)
sendKeyEvent in class Controlvoid setBounds(int x, int y, int width, int height, int flags)
public void setDoubleClickEnabled(boolean doubleClick)
The double click flag enables or disables the default action of the text widget when the user double clicks.
doubleClick - the new double click flagpublic void setEchoChar(char echo)
The echo character is the character that is displayed when the user enters text or the text is changed by the programmer. Setting the echo character to '0円' clears the echo character and redraws the original text. If for any reason the echo character is invalid, the default echo character for the platform is used.
echo - the new echo characterpublic void setEditable(boolean editable)
editable - the new editable statepublic void setFont(Font font)
public void setSelection(int start)
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 regular array indexing rules.
start - new caret positionpublic void setSelection(int start, int end)
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.
start - the start of the rangeend - the end of the rangepublic void setRedraw(boolean redraw)
redraw - the new redraw stateControl.redraw(),
Control.update()public void setSelection(Point selection)
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.
selection - the pointpublic void setTabs(int tabs)
Tab stop spacing is specified in terms of the space (' ') character. The width of a single tab stop is the pixel width of the spaces.
tabs - the number of tabs
void setTabStops(int tabs)
public void setText(String string)
public void setTextLimit(int limit)
Instead of trying to set the text limit to zero, consider creating a read-only text widget.
To reset this value to the default, use setTextLimit(Text.LIMIT).
limit - new text limitpublic void setTopIndex(int index)
index - the index of the top itempublic void showSelection()
If the selection is already showing in the receiver, this method simply returns. Otherwise, lines are scrolled until the selection is visible.
String verifyText(String string, int start, int end)
String verifyText(String string, int start, int end, Event keyEvent)
int wcsToMbcsPos(int wcsPos)
int widgetStyle()
widgetStyle in class Scrollableorg.eclipse.swt.internal.win32.TCHAR windowClass()
windowClass in class Scrollableint windowProc()
windowProc in class Scrollableorg.eclipse.swt.internal.win32.LRESULT WM_CHAR(int wParam, int lParam)
org.eclipse.swt.internal.win32.LRESULT WM_CLEAR(int wParam, int lParam)
org.eclipse.swt.internal.win32.LRESULT WM_CUT(int wParam, int lParam)
org.eclipse.swt.internal.win32.LRESULT WM_GETDLGCODE(int wParam, int lParam)
WM_GETDLGCODE in class Controlorg.eclipse.swt.internal.win32.LRESULT WM_IME_CHAR(int wParam, int lParam)
WM_IME_CHAR in class Controlorg.eclipse.swt.internal.win32.LRESULT WM_LBUTTONDBLCLK(int wParam, int lParam)
WM_LBUTTONDBLCLK in class Controlorg.eclipse.swt.internal.win32.LRESULT WM_PASTE(int wParam, int lParam)
org.eclipse.swt.internal.win32.LRESULT WM_UNDO(int wParam, int lParam)
org.eclipse.swt.internal.win32.LRESULT wmCommandChild(int wParam, int lParam)
wmCommandChild in class Control