public class SLTextBox extends SLBase
示例使用情况
textBox.setText("some text"); textBox.setSelection(0, 4); // 选择从第一个字符开始的 4 个字符 textBox.typeKeys("<Ctrl+C>"); // 复制所选文本至剪贴板 String selectedText = desktop.getClipboardText(); // 获取剪贴板中的文本
Modifier | Constructor and Description |
---|---|
protected |
SLTextBox(JtfObjectHandle handle,
Desktop desktop)
使用 JtfObjectHandle 创建新 SLTextBox。
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
删除文本字段中的所有文本。
|
String |
getText()
获取 文本框中显示的文本。
|
boolean |
isReadOnly()
获取 文本框是否为只读。
|
void |
setPosition(int position)
设置文本字段中的插入点。
|
void |
setSelection(int startPosition,
int length)
选择文本框中的一系列文本。
|
void |
setText(String text)
用指定文本替换文本字段中的文本。
|
click, click, click, click, doubleClick, doubleClick, doubleClick, doubleClick, getAutomationId, getClassName, getName, getRawChildren, getRawChildren, isEnabled, isFocused, mouseMove, mouseMove, pressKeys, pressKeys, pressMouse, pressMouse, pressMouse, pressMouse, releaseKeys, releaseKeys, releaseMouse, releaseMouse, releaseMouse, releaseMouse, setFocus, typeKeys, typeKeys, typeKeys, typePasswordKeys, typePasswordKeys, typePasswordKeys
captureBitmap, captureBitmap, exists, exists, generateLocator, getChildren, getDynamicMethodList, getParent, getPropertyList, getRect, getRect, getValue, highlightObject, highlightObject, highlightObject, invokeMethods, textCapture, textCapture, textClick, textClick, textClick, textClick, textClick, textClick, textExists, textExists, textExists, textExists, textExists, textRectangle, textRectangle, textRectangle, textRectangle, textRectangle, waitForChildDisappearance, waitForChildDisappearance, waitForDisappearance, waitForDisappearance, waitForObject, waitForObject, waitForProperty, waitForProperty
equals, exists, find, find, findAll, findAll, getCustomTypeName, getDesktop, getHandle, getLocator, getProperty, getTypeName, hashCode, imageClick, imageClick, imageClick, imageClick, imageClick, imageClick, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageClickFile, imageExists, imageExists, imageExists, imageExistsFile, imageExistsFile, imageExistsFile, imageRectangle, imageRectangle, imageRectangle, imageRectangleFile, imageRectangleFile, imageRectangleFile, invoke, preventFinalLocator, setProperty, toString
protected SLTextBox(JtfObjectHandle handle, Desktop desktop)
handle
- 可确定 SLTextBox 的句柄desktop
- 此对象所在的桌面public void clear()
public void setPosition(int position)
position
- 文本字段中脱字号的位置。. The value is zero-based.public void setSelection(int startPosition, int length)
startPosition
- 选定内容的开始索引. The value is zero-based.length
- 可从开始位置选择的字符的数量public void setText(String text)
text
- 新文本public boolean isReadOnly()
public String getText()
getText
in class TestObject
Copyright 2009-2012 Micro Focus. All Rights Reserved.