Package totalcross.ui
Class ListBox
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.ListBox
-
- All Implemented Interfaces:
Scrollable
- Direct Known Subclasses:
ColorList,DBListBox,ImageList,MultiListBox
public class ListBox extends Container implements Scrollable
ListBox is a complete implementation of a Listbox. You can use the up/down keys to scroll and enter the first letter of an item to select it.Note: the color used in the
setBackColor()method will be used in the scrollbar only. The background color of the control will be a lighter version of the given color.Here is an example showing how it can be used:
import totalcross.ui.*; public class MyProgram extends MainWindow { ListBox lb; public void initUI() { lb = new ListBox(); add(lb); lb.add(new String[]{"Daniel","Jenny","Helge","Sandra"}); lb.add("Marc"); // you may set the rect by using PREFERRED only after the items were added. lb.setRect(LEFT,TOP,PREFERRED,PREFERRED); // use control's preferred width based on the size of the elements } public void onEvent(Event event) { switch (event.type) { case ControlEvent.PRESSED: if (event.target == lb) Object element = lb.getSelectedItem(); // in most cases, this is just a String and may be casted to such } } }The first item has index 0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceListBox.CustomDrawingItemAn interface that makes easier to draw custom items.static classListBox.IconItemUsed to show an icon and a text.-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description protected intback0protected intback1protected intbtnXprotected intbtnX0protected intcustomCursorColorprotected intdataColUsed by the DBListBox to store the data column that is displayed.static doubleDEFAULT_ITEM_HEIGHT_FACTORbooleandrawBorderSet to false to disable border drawing.static intEXTRA_HEIGHT_FACTORWhen the ListBox has horizontal buttons and its height divided by the button height is greater than this value (10), the horizontal button heights are increased.intextraHorizScrollButtonHeightThe extra height of the horizontal scroll buttons.protected FlickflickThe Flick object listens and performs flick animations on PenUp events when appropriate.inticonGapThe gap between the icon and the text.protected doubleihFactorIntHashtableihtBackColorsIntHashtable used to specify different background colors for some items.IntHashtableihtForeColorsIntHashtable used to specify different foreground colors for some items.protected intitemCountstatic doubleitemHeightFactorIn finger touch devices, sets a factor by which the font height will be multiplied to increase the item's height.protected Vectoritemsprotected intoffsetprotected ScrollBarsbarprotected intselectedIndexprotected booleansimpleBorderprotected inttempSelectedIndexstatic booleanuseFullWidthOnSelectionIf true, all ListBox will have the selection bar drawn in the full width instead of the selected's text widthprotected intvisibleItemsintvisibleLinesSets the number of visible lines, used to make PREFERRED height return the given number of lines as the grid height.protected intxOffset-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(java.lang.Object item)Adds an Object to the Listboxvoidadd(java.lang.Object[] moreItems)Adds an array of Objects to the Listboxvoidadd(java.lang.Object[] moreItems, int startAt, int size)Deprecated.Useadd(Object[])insteadvoidadd(Control control)Do nothing.intaddWrapping(java.lang.String text)Adds the given text to this ListBox, breaking the text if it goes beyond the ListBox' limits, and also breaking if it contains \n.booleancanScrollContent(int direction, java.lang.Object target)Checks if there is room to flick this container in the given direction.voidclear()Clears this control, selecting index clearValueInt.protected voiddrawCursor(Graphics g, int sel, boolean on)This method is used to draw the cursor around the desired itemprotected voiddrawItem(Graphics g, int index, int dx, int dy)You can extend ListBox and overide this method to draw the itemsprotected voiddrawItems(Graphics g, int dx, int dy, int greatestVisibleItemIndex)protected voiddrawSelectedItem(Graphics g, int from, int to)protected voiddrawSelectedItem(Graphics g, int index, int dx, int dy)You can extend ListBox and overide this method to draw the itemsvoidenableHorizontalScroll()Adds support for horizontal scroll on this listbox.protected voidendSelection()protected voidfind(char c)Searches this ListBox for an item with the first letter matching the given char.voidflickEnded(boolean atPenDown)Called when the flick animation is ended.booleanflickStarted()Called when the flick animation is started.protected intgetCursorColor(int index)intgetEffectH()intgetEffectW()intgetEffectX()intgetEffectY()FlickgetFlick()Returns the current flick object.voidgetFocusableControls(Vector v)Get a list of child controls of this container which are focus candidatesjava.lang.ObjectgetItemAt(int i)Get the Object at the given Index.protected intgetItemHeight(int i)java.lang.Object[]getItems()Returns all items in this ListBox.protected java.lang.Object[]getItemsArray()Used internallyprotected intgetItemWidth(int index)Returns the width of the given item index with the current fontmetrics.intgetPreferredHeight()Returns the number of items multiplied by the font metrics heightintgetPreferredWidth()Returns the preferred width, ie, the size of the largest item plus the size of the scrollbar.intgetScrollPosition(int direction)Returns the current position given the direction.intgetSelectedIndex()Returns the position of the selected item of the Listbox or -1 if the listbox has no selected index yet.java.lang.ObjectgetSelectedItem()Returns the selected item of the Listbox or an empty String Object if none is selectedjava.lang.StringgetText()Returns the string of the selected item or "" if none is selected.ControlhandleGeographicalFocusChangeKeys(KeyEvent ke)Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.protected voidhandleSelection(int newSelection)booleanhideScrollBarIfNotNeeded()This method hides the scrollbar if its not needed, i.e., if horizontal scroll is disabled and the preferred height is smaller than the actual height.intindexOf(java.lang.Object name)Returns the index of the item specified by the name, or -1 if not found.voidinsert(java.lang.Object item, int index)Adds an Object to the Listbox at the given indexprotected voidleftReached()protected voidonBoundsChanged(boolean screenChanged)This is needed to recalculate the box size for the selected item if the control is resized by the main applicationprotected voidonColorsChanged(boolean colorsChanged)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonEvent(Event event)Handles the events for this control.voidonPaint(Graphics g)Draws the border (if any).voidqsort()Sorts the elements of this ListBox.voidqsort(boolean caseless)Sorts the elements of this ListBox.voidremove(int itemIndex)Removes the Object at the given index from the Listboxvoidremove(java.lang.Object item)Removes an Object from the Listboxvoidremove(Control control)Do nothing.voidremoveAll()Empties this ListBox, setting all elements of the array tonullso they can be garbage collected.booleanscrollContent(int xDelta, int yDelta, boolean fromFlick)Performs a relative move.voidselectLast()Selects the last item added to this listbox, doing a scroll if needed.voidselectLast(boolean sendPressEvent)Selects the last item added to this listbox, doing a scroll if needed, and sending or not the event.voidsetCursorColor(int color)Sets the cursor color for this ListBox.voidsetEnabled(boolean enabled)Sets if this container and all childrens can or not accept eventsvoidsetItemAt(int i, java.lang.Object s)Replace the Object at the given index, starting from 0voidsetSelectedIndex(int i)Select the given index and scroll to it if necessary.voidsetSelectedIndex(int i, boolean sendPressEvent)Select the given index and scroll to it if necessary, sending or not the pressed event.voidsetSelectedItem(java.lang.Object name)Selects the given name.booleansetSelectedItemStartingWith(java.lang.String text, boolean caseInsensitive)Selects the item that starts with the given textvoidsetSimpleBorder(boolean simpleBorder)Sets the border of the listbox to be not 3d if flag is true.protected voidsetTextAreaClip(Graphics g, int dx, int dy)intsize()Returns the number of itemsbooleanwasScrolled()Returns true if the control was scrolled since last pen down-
Methods inherited from class totalcross.ui.Container
add, add, add, add, applyTransitionEffect, broadcastEvent, fillBackground, 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, 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, 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, onFontChanged, 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
-
items
protected Vector items
-
offset
protected int offset
-
selectedIndex
protected int selectedIndex
-
tempSelectedIndex
protected int tempSelectedIndex
-
itemCount
protected int itemCount
-
visibleItems
protected int visibleItems
-
btnX
protected int btnX
-
btnX0
protected int btnX0
-
sbar
protected ScrollBar sbar
-
simpleBorder
protected boolean simpleBorder
-
xOffset
protected int xOffset
-
back0
protected int back0
-
back1
protected int back1
-
customCursorColor
protected int customCursorColor
-
iconGap
public int iconGap
The gap between the icon and the text. Used in IconItem. Defaults to fmH*4/3. If you plan to change this value, do it after calling setFont (if you call it).- Since:
- TotalCross 1.61
-
drawBorder
public boolean drawBorder
Set to false to disable border drawing.
-
EXTRA_HEIGHT_FACTOR
public static int EXTRA_HEIGHT_FACTOR
When the ListBox has horizontal buttons and its height divided by the button height is greater than this value (10), the horizontal button heights are increased.
-
ihtBackColors
public IntHashtable ihtBackColors
IntHashtable used to specify different background colors for some items. Example:list.ihtBackColor = new IntHashtable(10); ihtBackColors.put(10,0xAABBCC); // will make line number 10 with back color 0xAABBCC.
Specify a null value if you want to use the default back color (this also makes drawing faster). Note that its up to you to update the hashtable if an item is inserted or removed.- Since:
- TotalCross 1.0 beta 4
-
ihtForeColors
public IntHashtable ihtForeColors
IntHashtable used to specify different foreground colors for some items. Example:list.ihtForeColor = new IntHashtable(10); ihtForeColors.put(10,Color.RED); // will make line number 10 with fore color RED.
Specify a null value if you want to use the default fore color (this also makes drawing faster). Note that its up to you to update the hashtable if an item is inserted or removed.- Since:
- TotalCross 1.0 beta 4
-
extraHorizScrollButtonHeight
public int extraHorizScrollButtonHeight
The extra height of the horizontal scroll buttons. Defaults 2 in 160x160 or a multiple of it in other resolutions.- See Also:
EXTRA_HEIGHT_FACTOR,enableHorizontalScroll()
-
flick
protected Flick flick
The Flick object listens and performs flick animations on PenUp events when appropriate.
-
visibleLines
public int visibleLines
Sets the number of visible lines, used to make PREFERRED height return the given number of lines as the grid height.- Since:
- TotalCross 1.13
-
useFullWidthOnSelection
public static boolean useFullWidthOnSelection
If true, all ListBox will have the selection bar drawn in the full width instead of the selected's text width- Since:
- SuperWaba 5.5
-
DEFAULT_ITEM_HEIGHT_FACTOR
public static final double DEFAULT_ITEM_HEIGHT_FACTOR
- See Also:
- Constant Field Values
-
itemHeightFactor
public static double itemHeightFactor
In finger touch devices, sets a factor by which the font height will be multiplied to increase the item's height. Defaults to 1.5 when Settings.fingerTouch is true, and 1 when its false. You can change this value before the constructor and restore it after the constructor to change the height of a single ListBox.ListBox.itemHeightFactor = 1; ... create listbox ListBox.itemHeightFactor = ListBox.DEFAULT_ITEM_HEIGHT_FACTOR;
- Since:
- TotalCross 1.5
-
ihFactor
protected double ihFactor
-
dataCol
protected int dataCol
Used by the DBListBox to store the data column that is displayed.
-
-
Method Detail
-
flickStarted
public boolean flickStarted()
Description copied from interface:ScrollableCalled when the flick animation is started.- Specified by:
flickStartedin interfaceScrollable
-
flickEnded
public void flickEnded(boolean atPenDown)
Description copied from interface:ScrollableCalled when the flick animation is ended.- Specified by:
flickEndedin interfaceScrollable- Parameters:
atPenDown- Flag indicating if the animation ended due to a pendown event.
-
canScrollContent
public boolean canScrollContent(int direction, java.lang.Object target)Description copied from interface:ScrollableChecks if there is room to flick this container in the given direction.- Specified by:
canScrollContentin interfaceScrollable- Parameters:
direction- The direction we want to flick given by one of the following constants:target- The target of the series of PEN events that triggered this flick attempt.- Returns:
- true if the container can flick in the indicated direction.
-
scrollContent
public boolean scrollContent(int xDelta, int yDelta, boolean fromFlick)Description copied from interface:ScrollablePerforms a relative move.- Specified by:
scrollContentin interfaceScrollable- Parameters:
xDelta- The relative amount of pixels to move in the X axis.yDelta- The relative amount of pixels to move in the Y axis.
-
getScrollPosition
public int getScrollPosition(int direction)
Description copied from interface:ScrollableReturns the current position given the direction. Used on page scrolls.- Specified by:
getScrollPositionin interfaceScrollable
-
enableHorizontalScroll
public void enableHorizontalScroll()
Adds support for horizontal scroll on this listbox. Two buttons will appear below the vertical scrollbar. The add, replace and remove operations will be a bit slower because the string's width will have to be computed in order to correctly set the max horizontal scroll.- Since:
- SuperWaba 5.6
- See Also:
extraHorizScrollButtonHeight
-
add
public void add(java.lang.Object[] moreItems)
Adds an array of Objects to the Listbox
-
add
@Deprecated public void add(java.lang.Object[] moreItems, int startAt, int size)Deprecated.Useadd(Object[])insteadAdds a range of an array of Objects to the Listbox
-
add
public void add(java.lang.Object item)
Adds an Object to the Listbox
-
addWrapping
public int addWrapping(java.lang.String text)
Adds the given text to this ListBox, breaking the text if it goes beyond the ListBox' limits, and also breaking if it contains \n. Returns the number of lines. Note that each part of the text is considered a new item. This method is slower than the otheraddmethods.- Since:
- TotalCross 1.24
-
insert
public void insert(java.lang.Object item, int index)Adds an Object to the Listbox at the given index
-
removeAll
public void removeAll()
Empties this ListBox, setting all elements of the array tonullso they can be garbage collected. Attention! If you used the same object array to initialize two ListBoxes (or ComboBoxes), this method will null both ListBoxes (because they use the same array reference), and you'll get a null pointer exception!
-
remove
public void remove(int itemIndex)
Removes the Object at the given index from the Listbox
-
remove
public void remove(java.lang.Object item)
Removes an Object from the Listbox
-
setItemAt
public void setItemAt(int i, java.lang.Object s)Replace the Object at the given index, starting from 0
-
getItemAt
public java.lang.Object getItemAt(int i)
Get the Object at the given Index. Returns an empty string if the index is outside of range.
-
getSelectedItem
public java.lang.Object getSelectedItem()
Returns the selected item of the Listbox or an empty String Object if none is selected
-
getSelectedIndex
public int getSelectedIndex()
Returns the position of the selected item of the Listbox or -1 if the listbox has no selected index yet.
-
getItems
public java.lang.Object[] getItems()
Returns all items in this ListBox. If the elements are Strings, the array can be casted to String[].
-
getItemsArray
protected java.lang.Object[] getItemsArray()
Used internally
-
indexOf
public int indexOf(java.lang.Object name)
Returns the index of the item specified by the name, or -1 if not found.
-
setSelectedItem
public void setSelectedItem(java.lang.Object name)
Selects the given name. If the name is not found, the current selected item is not changed.- Since:
- SuperWaba 4.01
-
setSelectedIndex
public void setSelectedIndex(int i)
Select the given index and scroll to it if necessary.
-
setSelectedIndex
public void setSelectedIndex(int i, boolean sendPressEvent)Select the given index and scroll to it if necessary, sending or not the pressed event.
-
selectLast
public void selectLast()
Selects the last item added to this listbox, doing a scroll if needed. Calls repaintNow.- Since:
- SuperWaba 5.6
-
selectLast
public void selectLast(boolean sendPressEvent)
Selects the last item added to this listbox, doing a scroll if needed, and sending or not the event. Calls repaintNow.
-
size
public int size()
Returns the number of items
-
add
public void add(Control control)
Do nothing. Adding a control to a ListBox is nonsense.
-
remove
public void remove(Control control)
Do nothing. Removing a control from a ListBox is nonsense.
-
getPreferredWidth
public int getPreferredWidth()
Returns the preferred width, ie, the size of the largest item plus the size of the scrollbar.- Overrides:
getPreferredWidthin classControl
-
getPreferredHeight
public int getPreferredHeight()
Returns the number of items multiplied by the font metrics height- Overrides:
getPreferredHeightin classControl
-
onBoundsChanged
protected void onBoundsChanged(boolean screenChanged)
This is needed to recalculate the box size for the selected item if the control is resized by the main application- Overrides:
onBoundsChangedin classControl- Parameters:
screenChanged- If the bounds were changed due to a screen change (rotation, collapse)
-
find
protected void find(char c)
Searches this ListBox for an item with the first letter matching the given char. The search is made case insensitive. Note: if you override this class you must implement this method.
-
onEvent
public void onEvent(Event event)
Handles the events for this control.
-
leftReached
protected void leftReached()
-
endSelection
protected void endSelection()
-
handleSelection
protected void handleSelection(int newSelection)
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from class:ContainerSets if this container and all childrens can or not accept events- Overrides:
setEnabledin classContainer
-
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 classContainer
-
onPaint
public void onPaint(Graphics g)
Description copied from class:ContainerDraws the border (if any). If you override this method, be sure to callsuper.onPaint(g);, or the border will not be drawn.
-
getEffectW
public int getEffectW()
- Overrides:
getEffectWin classControl
-
getEffectH
public int getEffectH()
- Overrides:
getEffectHin classControl
-
getEffectX
public int getEffectX()
- Overrides:
getEffectXin classControl
-
getEffectY
public int getEffectY()
- Overrides:
getEffectYin classControl
-
drawItems
protected void drawItems(Graphics g, int dx, int dy, int greatestVisibleItemIndex)
-
getItemHeight
protected int getItemHeight(int i)
-
setTextAreaClip
protected void setTextAreaClip(Graphics g, int dx, int dy)
-
drawSelectedItem
protected void drawSelectedItem(Graphics g, int from, int to)
-
setCursorColor
public void setCursorColor(int color)
Sets the cursor color for this ListBox. The default is equal to the background slightly darker.
-
drawItem
protected void drawItem(Graphics g, int index, int dx, int dy)
You can extend ListBox and overide this method to draw the items
-
drawSelectedItem
protected void drawSelectedItem(Graphics g, int index, int dx, int dy)
You can extend ListBox and overide this method to draw the items
-
getItemWidth
protected int getItemWidth(int index)
Returns the width of the given item index with the current fontmetrics. Note: if you overide this class you must implement this method.
-
drawCursor
protected void drawCursor(Graphics g, int sel, boolean on)
This method is used to draw the cursor around the desired item
-
getCursorColor
protected int getCursorColor(int index)
-
setSimpleBorder
public void setSimpleBorder(boolean simpleBorder)
Sets the border of the listbox to be not 3d if flag is true.
-
qsort
public void qsort()
Sorts the elements of this ListBox. The current selection is cleared.
-
qsort
public void qsort(boolean caseless)
Sorts the elements of this ListBox. The current selection is cleared.- Parameters:
caseless- Pass true to make a caseless sort, if the items are Strings.
-
clear
public void clear()
Clears this control, selecting index clearValueInt.
-
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 classContainer- 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 classControl- 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
-
getText
public java.lang.String getText()
Returns the string of the selected item or "" if none is selected.
-
setSelectedItemStartingWith
public boolean setSelectedItemStartingWith(java.lang.String text, boolean caseInsensitive)Selects the item that starts with the given text- Parameters:
text- The text string to search forcaseInsensitive- If true, the text and all searched strings are first converted to lowercase.- Returns:
- If an item was found and selected.
- Since:
- TotalCross 1.13
-
hideScrollBarIfNotNeeded
public boolean hideScrollBarIfNotNeeded()
This method hides the scrollbar if its not needed, i.e., if horizontal scroll is disabled and the preferred height is smaller than the actual height. You may have to callrepositionif this method returns true. You can call this method after all items were added.- Returns:
- True if the scrollbar was hidden.
- Since:
- TotalCross 1.15
-
getFlick
public Flick getFlick()
Description copied from interface:ScrollableReturns the current flick object.- Specified by:
getFlickin interfaceScrollable
-
wasScrolled
public boolean wasScrolled()
Description copied from interface:ScrollableReturns true if the control was scrolled since last pen down- Specified by:
wasScrolledin interfaceScrollable
-
-