Package totalcross.ui.dialog.keyboard
Class VirtualKeyboard
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.Window
-
- totalcross.ui.dialog.keyboard.VirtualKeyboard
-
public class VirtualKeyboard extends Window
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description protected AlphabetKeyboardalfaKeyboardRepresents the container's letters keyboardbooleanbtnCancelPressedstatic inticonColorprotected static booleanisOpenprotected static VirtualKeyboardkeyboardprotected NumericAndSymbolsKeyboardnumericKeyboardRepresents the container's numeric keyboardprotected inttotalTimejava.lang.Stringvalue-
Fields inherited from class totalcross.ui.Window
_controlEvent, _dragEvent, _focus, _keyEvent, _mouseEvent, _multiEvent, _penEvent, androidBorderThickness, beepIfOut, blocking, borderStyle, cancelPenUp, canDrag, dragThreshold, fadeOtherWindows, fadeValue, firstFocus, flickEnabled, focusOnPenUp, footerColor, footerH, gradientTitleEndColor, gradientTitleStartColor, headerColor, highlighted, highResPrepared, HORIZONTAL_GRADIENT, ignoreEventOfType, keyHook, lastShiftY, lastSwappedContainer, mainSwapContainer, menubar, multiTouching, needsPaint, NO_BORDER, ORIENTATION_INVERTED, ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, popped, RECT_BORDER, repaintOnSwap, robot, ROUND_BORDER, rTitle, sameBackgroundColor, shiftH, shiftY, SIP_BOTTOM, SIP_HIDE, SIP_SHOW, SIP_TOP, TAB_BORDER, TAB_ONLY_BORDER, tempTitle, title, titleAlign, titleColor, titleFont, titleGap, topMost, VERTICAL_GRADIENT, zStack
-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, borderRadius, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, npback, numChildren, started, tabOrder, tail, TRANSITION_TIME
-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedVirtualKeyboard()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static VirtualKeyboardgetInstance()This method returns the last created instance of the VirtualKeyboard.static VirtualKeyboardgetInstance(Control c)java.lang.StringgetText()Returns the value on the VirtualKeyboardvoidonEvent(Event event)Called to process key, pen, control and other posted events.protected voidonPopup()Placeholder called imediatly before the popup began.protected voidonUnpop()Placeholder called imediatly before the unpop began.protected booleanorganizarVisibilidadeTecladoAlfa()Organizes the visible buttons in accordance with the valid characters.protected booleanorganizeNumericKeyboardVisibility()Organizes the visible buttons in accordance with the valid characters.static voidorientationChanged(boolean changed)voidpopup()Pops up this window, blocking the execution until the window closes.protected voidpostPopup()Placeholder called after the popup is done and after the repaint of this window.voidpostUnpop()Placeholder called after the unpop is done and after the repaint of the other window.voidscreenResized()Called when the screen is resized, probably caused by a rotation.voidsetCursorPos()voidsetCursorPosEnd()voidsetFocus(Control c)Sets focus to the given control.voidsetMaxLength(int maxLength)Sets the max string sizevoidsetMode(byte mode)protected voidsetRect(boolean screenResized)voidsetText(java.lang.String text)Sets the text on the VirtualKeyboard Edit.voidsetValidChars(java.lang.String validCharsString)Sets the possible characters to be written on the keyboard.voidsetValue(java.lang.String value)Sets the value used when you open the keyboard.static voidupdateImages(Image imgOk, Image imgCancel, Image imgBackSpace, Image img123, Image imgAbc)static voidupdateMessages(java.lang.String strCancelar, java.lang.String strLimpar)Deprecated.static voidupdateStrCancel(java.lang.String strCancel)Updates the cancel string;-
Methods inherited from class totalcross.ui.Window
_doPaint, _postEvent, destroyZStack, drawHighlight, getBorderStyle, getClientRect, getClientRect, getDefaultDragThreshold, getFocus, getHighlighted, getPopupCount, getPreferredHeight, getPreferredWidth, getSafeAreaInsets, getTitleFont, getTopMost, handleFocusChangeKeys, isScreenShifted, isSipShown, isSipShown4D, isTopMost, isVisible, loadBehind, makeUnmovable, onClickedOutside, onRobotKey, paintTitle, paintWindowBackground, popupMenuBar, popupNonBlocking, postPressedEvent, pumpEvents, removeFocus, repaintActiveWindows, resize, resizeHeight, resizeWidth, setBorderStyle, setDeviceTitle, setGrabPenEvents, setHighlighted, setMenuBar, setOrientation, setSIP, setTitle, setTitleFont, shiftScreen, swap, swapFocus, unpop, validate
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, broadcastEvent, clear, fillBackground, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderRadius, getChildren, getChildrenCount, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onColorsChanged, onPaint, onRemove, onSwapFinished, paintChildren, remove, removeAll, setBorderRadius, setEnabled, setFocusTraversable, setHighlighting, setInsets, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isVisibleAndInside, onBoundsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
value
public java.lang.String value
-
numericKeyboard
protected NumericAndSymbolsKeyboard numericKeyboard
Represents the container's numeric keyboard
-
alfaKeyboard
protected AlphabetKeyboard alfaKeyboard
Represents the container's letters keyboard
-
keyboard
protected static VirtualKeyboard keyboard
-
isOpen
protected static boolean isOpen
-
btnCancelPressed
public boolean btnCancelPressed
-
iconColor
public static int iconColor
-
totalTime
protected int totalTime
-
-
Method Detail
-
orientationChanged
public static void orientationChanged(boolean changed)
-
getInstance
public static VirtualKeyboard getInstance()
This method returns the last created instance of the VirtualKeyboard. In case there isn't one it will return null (This method should only be used to retrieve an instance, not create one).- Returns:
-
getInstance
public static VirtualKeyboard getInstance(Control c)
- Returns:
-
onPopup
protected void onPopup()
Description copied from class:WindowPlaceholder called imediatly before the popup began. The default implementation does nothing.
-
setRect
protected void setRect(boolean screenResized)
-
popup
public void popup()
Description copied from class:WindowPops up this window, blocking the execution until the window closes.
-
postPopup
protected void postPopup()
Description copied from class:WindowPlaceholder called after the popup is done and after the repaint of this window. The default implementation does nothing.
-
postUnpop
public void postUnpop()
Description copied from class:WindowPlaceholder called after the unpop is done and after the repaint of the other window. The default implementation does nothing.
-
onUnpop
protected void onUnpop()
Description copied from class:WindowPlaceholder called imediatly before the unpop began. The default implementation does nothing.
-
organizarVisibilidadeTecladoAlfa
protected boolean organizarVisibilidadeTecladoAlfa()
Organizes the visible buttons in accordance with the valid characters.- Returns:
- returns a boolean which signals if the letters keyboard should appear or not
-
organizeNumericKeyboardVisibility
protected boolean organizeNumericKeyboardVisibility()
Organizes the visible buttons in accordance with the valid characters.- Returns:
- returns a boolean which signals if the numeric keyboard should appear or not
-
setValue
public void setValue(java.lang.String value)
Sets the value used when you open the keyboard.- Parameters:
value-
-
getText
public java.lang.String getText()
Returns the value on the VirtualKeyboard- Returns:
- String value
-
setText
public void setText(java.lang.String text)
Sets the text on the VirtualKeyboard Edit.- Parameters:
text- new text
-
setValidChars
public void setValidChars(java.lang.String validCharsString)
Sets the possible characters to be written on the keyboard. If the value is null, any character can be used.
-
setMaxLength
public void setMaxLength(int maxLength)
Sets the max string size- Parameters:
maxLength2-
-
setMode
public void setMode(byte mode)
-
setFocus
public void setFocus(Control c)
Description copied from class:WindowSets focus to the given control. When a user types a key, the control with focus get the key event. At any given time, only one control in a window can have focus. Calling this method will cause a FOCUS_OUT control event to be posted to the window's current focus control (if one exists) and will cause a FOCUS_IN control event to be posted to the new focus control.
-
onEvent
public void onEvent(Event event)
Description copied from class:ControlCalled to process key, pen, control and other posted events.
-
setCursorPosEnd
public void setCursorPosEnd()
-
setCursorPos
public void setCursorPos()
-
updateMessages
public static void updateMessages(java.lang.String strCancelar, java.lang.String strLimpar)Deprecated.Updates the messages.- Parameters:
strCancelar-strLimpar-
-
updateStrCancel
public static void updateStrCancel(java.lang.String strCancel)
Updates the cancel string;- Parameters:
strCancel-
-
updateImages
public static void updateImages(Image imgOk, Image imgCancel, Image imgBackSpace, Image img123, Image imgAbc)
-
screenResized
public void screenResized()
Description copied from class:WindowCalled when the screen is resized, probably caused by a rotation. ATTENTION: THIS CALL CANNOT BE BLOCKED OR THE SYSTEM WILL LOCK!- Overrides:
screenResizedin classWindow
-
-