|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
totalcross.lang.Objecttotalcross.ui.gfx.GfxSurface
totalcross.ui.Control
totalcross.ui.Container
totalcross.ui.ComboBox
public class ComboBox
ComboBox is an implementation of a ComboBox, with the drop down window implemented by the ComboBoxDropDown class.
Note: the color used in the setBackground method will be used in the button only. The background color of the control will be a lighter version of the given color.
| Field Summary | |
|---|---|
boolean |
fullHeight
If set to true, the popup window will have the height of the screen |
boolean |
fullWidth
If set to true, the popup window will have the width of the screen |
protected ComboBoxDropDown |
pop
|
| Fields inherited from class totalcross.ui.Container |
|---|
alwaysEraseBackground, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, nextTransitionEffect, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_NONE, TRANSITION_OPEN, transitionEffect |
| Fields inherited from class totalcross.ui.Control |
|---|
AFTER, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, CENTER, CENTER_OF, clearValueInt, clearValueStr, enabled, enableUpdateScreen, FILL, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, foreColor, height, isHighlighting, KEEP, LEFT, onEventFirst, parent, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, setFont, setH, setRel, setW, setX, setY, TOP, transparentBackground, uiCE, uiFlat, uiPalm, uiVista, visible, width, WILL_RESIZE, x, y |
| Constructor Summary | |
|---|---|
ComboBox()
Creates an empty ComboBox |
|
ComboBox(ComboBoxDropDown userPopList)
Constructs a ComboBox with the given PopList. |
|
ComboBox(ListBox userListBox)
Creates a ComboBox with a PopList containing the given ListBox. |
|
ComboBox(Object[] items)
Creates a ComboBox with the given items |
|
| Method Summary | |
|---|---|
void |
add(Control control)
Does nothing |
void |
add(Object item)
Adds an totalcross.lang.Object to the Listbox. |
void |
add(Object[] items)
Adds an array of Objects to the Listbox |
void |
add(Object[] items,
int startAt,
int size)
Adds an array of Objects to the Listbox |
void |
clear()
Clears this control, selecting index clearValueInt (0 by default). |
protected void |
drawSelectedItem(Graphics g)
|
void |
enableHorizontalScroll()
Adds support for horizontal scroll on this listbox. |
void |
getFocusableControls(Vector v)
Get a list of child controls of this container which are focus candidates |
Object |
getItemAt(int i)
Get the totalcross.lang.Object at the given Index |
Object[] |
getItems()
Returns all items in this ComboBox |
ListBox |
getListBox()
Returns the ListBox used when this combobox is opened. |
int |
getPreferredHeight()
Returns the preferred height of this control. |
int |
getPreferredWidth()
Returns the preferred width of this control. |
int |
getSelectedIndex()
Returns the position of the selected item of the ListBox |
Object |
getSelectedItem()
Returns the selected item of the ListBox |
Control |
handleGeographicalFocusChangeKeys(KeyEvent ke)
Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent. |
int |
indexOf(Object name)
Returns the index of the item specified by the name |
void |
insert(Object item,
int index)
Adds an totalcross.lang.Object to the Listbox at the given index |
protected void |
onBoundsChanged(boolean screenChanged)
Called after a setRect. |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. |
void |
onEvent(Event event)
Called to process key, pen, control and other posted events. |
protected void |
onFontChanged()
Passes the font to the pop list |
void |
onPaint(Graphics g)
paint the combo's border and the current selected item |
void |
popup()
Pops up the ComboBoxDropDown |
void |
qsort()
Sorts the items of this combobox, and then unselects the current item. |
void |
qsort(boolean caseless)
Sorts the elements of this ListBox. |
void |
remove(Control control)
Does nothing |
void |
remove(int itemIndex)
Removes an totalcross.lang.Object from the Listbox at the given index. |
void |
remove(Object item)
Removes an totalcross.lang.Object from the Listbox |
void |
removeAll()
Empties the ListBox |
void |
selectLast()
Selects the last item added to this combobox, doing a scroll if needed. |
void |
setBackForeItemColors(IntHashtable ihtFore,
IntHashtable ihtBack)
Sets the ihtForeColors and ihtBackColors for the ListBox used with this ComboBox. |
void |
setCursorColor(int color)
Sets the cursor color for this ComboBox. |
void |
setItemAt(int i,
Object s)
Sets the totalcross.lang.Object at the given Index, starting from 0 |
void |
setSelectedIndex(int i)
Select the given index. |
void |
setSelectedItem(Object name)
Selects an item. |
boolean |
setSelectedItemStartingWith(String text,
boolean caseInsensitive)
Selects the item that starts with the given text |
int |
size()
Returns the number of items |
void |
unpop()
Unpops the ComboBoxDropDown. |
protected void |
updatePopRect()
|
| Methods inherited from class totalcross.ui.Container |
|---|
add, add, add, add, broadcastEvent, findChild, findNearestChild, findNextFocusControl, getBorderStyle, getChildren, getClientRect, getClientRect, getInsets, incLastX, incLastY, initUI, onAddAgain, onRemove, paintChildren, resize, resizeHeight, resizeWidth, setBorderStyle, setEnabled, setHighlighting, setInsets, swapToTopmostWindow |
| Methods inherited from class totalcross.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ComboBoxDropDown pop
public boolean fullHeight
public boolean fullWidth
| Constructor Detail |
|---|
public ComboBox()
public ComboBox(Object[] items)
public ComboBox(ListBox userListBox)
public ComboBox(ComboBoxDropDown userPopList)
| Method Detail |
|---|
public void add(Control control)
add in class Containerpublic void remove(Control control)
remove in class Containerpublic void add(Object[] items)
public void add(Object[] items,
int startAt,
int size)
public void add(Object item)
add(totalcross.lang.Object[]) to add a bunch of objects instead.
public void insert(Object item,
int index)
public void removeAll()
removeAll in class Containerpublic void remove(Object item)
public void remove(int itemIndex)
public void setItemAt(int i,
Object s)
public Object getItemAt(int i)
public Object getSelectedItem()
public int getSelectedIndex()
public Object[] getItems()
public int indexOf(Object name)
public void setCursorColor(int color)
public void setSelectedItem(Object name)
public void setSelectedIndex(int i)
public int size()
public int getPreferredWidth()
Control
getPreferredWidth in class Controlpublic int getPreferredHeight()
Control
getPreferredHeight in class Controlprotected void onFontChanged()
onFontChanged in class Control
public void setBackForeItemColors(IntHashtable ihtFore,
IntHashtable ihtBack)
protected void onBoundsChanged(boolean screenChanged)
Control
onBoundsChanged in class ControlscreenChanged - If the bounds were changed due to a screen change (rotation, collapse)public void onEvent(Event event)
Control
onEvent in class Controlevent - the event to processEvent,
KeyEvent,
PenEventprotected void updatePopRect()
public void popup()
public void unpop()
protected void onColorsChanged(boolean colorsChanged)
Control
onColorsChanged in class Containerpublic void onPaint(Graphics g)
onPaint in class Containerg - the graphics object for drawingGraphicsprotected void drawSelectedItem(Graphics g)
public void qsort()
public void qsort(boolean caseless)
caseless - Pass true to make a caseless sort, if the items are Strings.public void enableHorizontalScroll()
public void selectLast()
public void clear()
clear in class Containerpublic void getFocusableControls(Vector v)
Container
getFocusableControls in class Containerv - A vector into which to add the focus candidates.public Control handleGeographicalFocusChangeKeys(KeyEvent ke)
Control
handleGeographicalFocusChangeKeys in class Controlke - The KeyEvent to be processed
Settings.geographicalFocuspublic ListBox getListBox()
public boolean setSelectedItemStartingWith(String text,
boolean caseInsensitive)
text - The text string to search forcaseInsensitive - If true, the text and all searched strings are first converted to lowercase.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||