public class SpenControlTextBox extends SpenControlBase
STYLE_BORDER_NONE, STYLE_BORDER_NONE_ACTION_NONE, STYLE_BORDER_OBJECT, STYLE_BORDER_STATIC| Constructor and Description |
|---|
SpenControlTextBox(Context context,
SpenPageDoc pageDoc)
Creates an SpenControlTextBox instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendText(String str)
Append the specified text to the text box control.
|
void |
close()
Close the text box control.
|
void |
fit(boolean checkCursorPosition)
Fit control region according to object's size in list.
|
SpenObjectTextBox |
getObject()
Get the text box object.
|
int |
getPixel(int x,
int y)
Get the color at the specified location in the text box control.
|
String |
getText(boolean onlySelection)
Get the text that is displayed in the text box control.
|
int |
getTextCursorPosition()
Get the current cursor position in the text box control.
|
int |
getTextLimit()
Get the text length allowed in the text box control.
|
SpenSettingTextInfo |
getTextSettingInfo()
Get the text settings information for the text box control.
|
void |
hideSoftInput()
Hide soft input.
|
boolean |
isContextMenuVisible()
Check if the context menu is visible.
|
boolean |
isEditable()
Check if the text box control object is editable.
|
boolean |
isSelectByKey()
Check if text is selected by keyboard or touch action.
|
void |
onDraw(Canvas canvas)
Called when a text object is drawn on the canvas.
|
boolean |
onTouchEvent(MotionEvent event)
Called when a touch event occurs in the text box control.
|
void |
removeText()
Remove the text in the text box control.
|
void |
selectAllText()
Select all the text in the text box control.
|
void |
setContextMenuVisible(boolean visible)
Enable or disable the visibility of the context menu.
|
void |
setEditable(boolean enable)
Enable or disable editing in the text box control from user using keyboard.
|
void |
setMargin(int left,
int top,
int right,
int bottom)
Set the specified margin for the text box control.
|
void |
setObject(SpenObjectTextBox ObjectTextBox)
Set the specified text box object.
|
void |
setSelection(int start,
int end)
Set the specified anchor to start and the specified edge to end the text selection.
|
void |
setText(String str)
Set the specified text for the text box control.
|
void |
setTextCursorPosition(int index)
Set the cursor at the specified position.
|
void |
setTextLimit(int count)
Set the specified allowable length for text in the text box control.
|
void |
setTextSelectionContextMenu(SpenContextMenu contextMenu)
Set the specified context menu for the text box control.
|
void |
setTextSettingInfo(SpenSettingTextInfo info)
Set the specified text settings information for the text box control.
|
void |
setTouchEnabled(boolean enable)
Enable or disable touch events for the text box control.
|
void |
showSoftInput()
Show soft input.
|
fit, getContextMenu, getMinResizeRect, getObjectList, getRect, getStyle, isClosed, isContextMenuItemEnabled, isDimEnabled, isObjectOutlineEnabled, isTouchEnabled, onConfigurationChanged, onHoverEvent, onWindowFocusChanged, setContextMenu, setContextMenuItemEnabled, setDimEnabled, setMinResizeRect, setObjectOutlineEnabled, setStylepublic SpenControlTextBox(Context context, SpenPageDoc pageDoc)
context - The context for the application.pageDoc - The current PageDoc.NullPointerException - Thrown if context is null.public void setEditable(boolean enable)
enable - Set to true to enable editing in the text box control, set to false to disable editing in the text
box control.
When you disable editing, the text box control is not focusable in touch mode.isEditable()public boolean isEditable()
setEditable(boolean)public void showSoftInput()
public void hideSoftInput()
public void fit(boolean checkCursorPosition)
checkCursorPosition - If the param is true, recent cursor position will be shown in textbox.public void setObject(SpenObjectTextBox ObjectTextBox)
ObjectTextBox - The text box object for the control.public SpenObjectTextBox getObject()
public void appendText(String str)
str - The text to add to the control.IllegalArgumentException - Thrown if str is null.public void removeText()
public void setMargin(int left,
int top,
int right,
int bottom)
left - The left margin.top - The top margin.right - The right margin.bottom - The bottom margin.public void setText(String str)
str - The text to set in the text box control.IllegalArgumentException - Thrown if str is null.public String getText(boolean onlySelection)
onlySelection - Set to true to get only the selected text, set to false to get all the text in the text box control.public void setTextCursorPosition(int index)
index - The cursor position.IllegalStateException - Thrown if the text box control is not editable.IllegalArgumentException - Thrown if text is empty, index is negative number or index is greater than string
length of TextBoxpublic int getTextCursorPosition()
IllegalStateException - Thrown if the text box control is not editable.public void setTextLimit(int count)
count - The maximum text length. Set a limit value greater than or equal to zero and less than 5000.IllegalArgumentException - Thrown when the count value passed is less than 0.public int getTextLimit()
public void setSelection(int start,
int end)
start - Position of start cursorend - Position of start cursorIllegalStateException - Thrown if the text box control is not editable.IllegalArgumentException - Thrown if start is greater than end, start is negative number or
end is greater than string length of TextBoxpublic void selectAllText()
IllegalStateException - Thrown if the text box control is not editable.public void setTextSelectionContextMenu(SpenContextMenu contextMenu)
contextMenu - -The context menu that you want to set.public void setTextSettingInfo(SpenSettingTextInfo info)
info - The text settings information object.NullPointerException - Thrown if info is null.public SpenSettingTextInfo getTextSettingInfo()
public boolean isSelectByKey()
public int getPixel(int x,
int y)
getPixel in class SpenControlBasex - The X coordinate.y - The Y coordinate.public void setContextMenuVisible(boolean visible)
setContextMenuVisible in class SpenControlBasevisible - Context visible attribute.
Set to true to make the context menu visible,
set to false to make it invisible.isContextMenuVisible()public boolean isContextMenuVisible()
isContextMenuVisible in class SpenControlBasesetContextMenuVisible(boolean)public void setTouchEnabled(boolean enable)
setTouchEnabled in class SpenControlBaseenable - Set to true to enable touch events, set to false to disable touch events.SpenControlBase.isTouchEnabled()public void close()
close in class SpenControlBasepublic boolean onTouchEvent(MotionEvent event)
onTouchEvent in class SpenControlBasepublic void onDraw(Canvas canvas)
onDraw in class SpenControlBasecanvas - The Canvas instance on which objects are drawn