Package totalcross.ui
Class ComboBoxEditable
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.ComboBox
-
- totalcross.ui.ComboBoxEditable
-
- All Implemented Interfaces:
MaterialEffect.SideEffect,KeyListener,PressListener,TimerListener
public class ComboBoxEditable extends ComboBox implements PressListener, KeyListener
The ComboBoxEditable is a control usually used as an Edit that holds old typed values. When the user types a word, it is automatically selected in the ComboBox. Here's a sample of how to use it:String[] items = {"Ana","Barbara","Raul","Marcelo","Eduardo","Denise","Michelle","Guilherme","Vera","Dulce","Leonardo","Andre","Gustavo","Anne","Renato","Zelia","Helio"}; ComboBoxEditable cbe = new ComboBoxEditable(items); cbe.qsort(); add(cbe, LEFT,BOTTOM-100);
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description EditeditThe edit used in this ComboBox.-
Fields inherited from class totalcross.ui.ComboBox
arrowStyle, ARROWSTYLE_DOWNDOT, ARROWSTYLE_PAGEFLIP, caption, captionColor, captionIcon, captionPress, checkColor, defaultClearValueInt, enableSearch, fullHeight, fullWidth, pop, popupTitle, usePopupMenu
-
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, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
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, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, nextTabControl, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description ComboBoxEditable()ComboBoxEditable(java.lang.Object[] items)ComboBoxEditable(ComboBoxDropDown userPopList)ComboBoxEditable(ListBox userListBox)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionkeyPressed(KeyEvent e)An ACTION_KEY_PRESS event was dispatched.voidcontrolPressed(ControlEvent e)A PRESSED event was dispatched.protected voiddrawSelectedItem(Graphics g)voidgetFocusableControls(Vector v)Get a list of child controls of this container which are focus candidatesControlhandleGeographicalFocusChangeKeys(KeyEvent ke)Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.voidkeyPressed(KeyEvent e)A KEY_PRESS event was dispatched.protected voidonBoundsChanged(boolean screenChanged)Called after a setRect.protected voidonColorsChanged(boolean colorsChanged)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonEvent(Event e)Called to process key, pen, control and other posted events.protected voidonFontChanged()Passes the font to the pop listvoidpopup()Pops up the ComboBoxDropDownvoidsetAutoAdd(boolean on, boolean keepSorted)Set to true to add automatically new names that were typed in the edit.voidspecialkeyPressed(KeyEvent ke)A SPECIAL_KEY_PRESS event was dispatched.voidunpop()Closes the open ListBox.-
Methods inherited from class totalcross.ui.ComboBox
add, add, add, add, addWrapping, clear, enableHorizontalScroll, equals, getArrowColor, getItemAt, getItems, getListBox, getPreferredHeight, getPreferredWidth, getSelectedIndex, getSelectedItem, indexOf, insert, onPaint, qsort, qsort, remove, remove, remove, removeAll, selectLast, setBackForeItemColors, setCursorColor, setItemAt, setPop, setSelectedIndex, setSelectedIndex, setSelectedItem, setSelectedItem, setSelectedItemStartingWith, setSelectedItemStartingWith, sidePaint, sideStart, sideStop, size, timerTriggered, updatePopRect
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, applyTransitionEffect, broadcastEvent, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderStyle, getChildren, getChildrenCount, getClientRect, getClientRect, getFirstChild, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onRemove, onSwapFinished, paintChildren, resize, resizeHeight, resizeWidth, setBorderStyle, setEnabled, setFocusTraversable, setHighlighting, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addTimer, addTimer, addTimerListener, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, 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, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
edit
public Edit edit
The edit used in this ComboBox. You can customize it if you need.
-
-
Constructor Detail
-
ComboBoxEditable
public ComboBoxEditable()
-
ComboBoxEditable
public ComboBoxEditable(java.lang.Object[] items)
-
ComboBoxEditable
public ComboBoxEditable(ListBox userListBox)
-
ComboBoxEditable
public ComboBoxEditable(ComboBoxDropDown userPopList)
-
-
Method Detail
-
setAutoAdd
public void setAutoAdd(boolean on, boolean keepSorted)Set to true to add automatically new names that were typed in the edit.- Parameters:
on- Flag indicating if autoAdd must be setkeepSorted- If the list must be sorted after a new item is added by the autoAdd.
-
onFontChanged
protected void onFontChanged()
Description copied from class:ComboBoxPasses the font to the pop list- Overrides:
onFontChangedin classComboBox
-
onColorsChanged
protected void onColorsChanged(boolean colorsChanged)
Description copied from class:ControlCalled after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled- Overrides:
onColorsChangedin classComboBox
-
onBoundsChanged
protected void onBoundsChanged(boolean screenChanged)
Description copied from class:ControlCalled after a setRect.- Overrides:
onBoundsChangedin classComboBox- Parameters:
screenChanged- If the bounds were changed due to a screen change (rotation, collapse)
-
onEvent
public void onEvent(Event e)
Description copied from class:ControlCalled to process key, pen, control and other posted events.
-
popup
public void popup()
Description copied from class:ComboBoxPops up the ComboBoxDropDown
-
drawSelectedItem
protected void drawSelectedItem(Graphics g)
- Overrides:
drawSelectedItemin classComboBox
-
controlPressed
public void controlPressed(ControlEvent e)
Description copied from interface:PressListenerA PRESSED event was dispatched.- Specified by:
controlPressedin interfacePressListener- See Also:
ControlEvent
-
actionkeyPressed
public void actionkeyPressed(KeyEvent e)
Description copied from interface:KeyListenerAn ACTION_KEY_PRESS event was dispatched.- Specified by:
actionkeyPressedin interfaceKeyListener- See Also:
KeyEvent
-
keyPressed
public void keyPressed(KeyEvent e)
Description copied from interface:KeyListenerA KEY_PRESS event was dispatched.- Specified by:
keyPressedin interfaceKeyListener- See Also:
KeyEvent
-
specialkeyPressed
public void specialkeyPressed(KeyEvent ke)
Description copied from interface:KeyListenerA SPECIAL_KEY_PRESS event was dispatched.- Specified by:
specialkeyPressedin interfaceKeyListener- See Also:
KeyEvent
-
getFocusableControls
public void getFocusableControls(Vector v)
Description copied from class:ContainerGet a list of child controls of this container which are focus candidates- Overrides:
getFocusableControlsin classComboBox- Parameters:
v- A vector into which to add the focus candidates.
-
handleGeographicalFocusChangeKeys
public Control handleGeographicalFocusChangeKeys(KeyEvent ke)
Description copied from class:ControlUsed by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.- Overrides:
handleGeographicalFocusChangeKeysin classComboBox- Parameters:
ke- The KeyEvent to be processed- Returns:
- The control that should get focus as a result of this KeyEvent. Null if this control did not handle the KeyEvent.
- See Also:
Settings.geographicalFocus
-
-