Package totalcross.ui

Class 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);
     
    • 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)
    • 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 set
        keepSorted - If the list must be sorted after a new item is added by the autoAdd.
      • onFontChanged

        protected void onFontChanged()
        Description copied from class: ComboBox
        Passes the font to the pop list
        Overrides:
        onFontChanged in class ComboBox
      • onColorsChanged

        protected void onColorsChanged​(boolean colorsChanged)
        Description copied from class: Control
        Called 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:
        onColorsChanged in class ComboBox
      • onBoundsChanged

        protected void onBoundsChanged​(boolean screenChanged)
        Description copied from class: Control
        Called after a setRect.
        Overrides:
        onBoundsChanged in class ComboBox
        Parameters:
        screenChanged - If the bounds were changed due to a screen change (rotation, collapse)
      • onEvent

        public void onEvent​(Event e)
        Description copied from class: Control
        Called to process key, pen, control and other posted events.
        Overrides:
        onEvent in class ComboBox
        Parameters:
        e - the event to process
        See Also:
        Event, KeyEvent, PenEvent
      • popup

        public void popup()
        Description copied from class: ComboBox
        Pops up the ComboBoxDropDown
        Overrides:
        popup in class ComboBox
      • unpop

        public void unpop()
        Closes the open ListBox.
        Overrides:
        unpop in class ComboBox
      • getFocusableControls

        public void getFocusableControls​(Vector v)
        Description copied from class: Container
        Get a list of child controls of this container which are focus candidates
        Overrides:
        getFocusableControls in class ComboBox
        Parameters:
        v - A vector into which to add the focus candidates.
      • handleGeographicalFocusChangeKeys

        public Control handleGeographicalFocusChangeKeys​(KeyEvent ke)
        Description copied from class: Control
        Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.
        Overrides:
        handleGeographicalFocusChangeKeys in class ComboBox
        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