Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## waba.ui
Class Edit

    java.lang.Object
      |
      +--waba.ui.Control
            |
            +--waba.ui.Edit

public class Edit
extends Control

Edit is a text entry control.

Here is an example showing an edit control being used:

     public class MyProgram extends MainWindow
     {
     Edit edit;

     public void onStart()
      {
      edit = new Edit(""); // mask used to compute preferred width - empty = fill width
      add(edit,LEFT,TOP);
      }

Field Summary
`static byte` | `ALL_LOWER` to be used in the setCapitaliseMode method
`static byte` | `ALL_NORMAL` to be used in the setCapitaliseMode method
`static byte` | `ALL_UPPER` to be used in the setCapitaliseMode method
`static Calculator` | `calculator`
`static Calendar` | `calendar`
`static byte` | `CURRENCY` to be used in the setMode method
`static String` | `currencyCharsSet` to be used in the setValidChars method
`static byte` | `DATE` to be used in the setMode method
`static String` | `dateSet` to be used in the setValidChars method
`boolean` | `hasCursorWhenNotEditable` Set to false if you don't want the cursor to blink when the edit is not editable
`static byte` | `KBD_CALCULATOR` The Calculator will be used for this Edit
`static byte` | `KBD_CALENDAR` The Calendar will be used for this Edit
`static byte` | `KBD_DEFAULT` The default keyboard for the current mode will be used for this Edit
`static byte` | `KBD_KEYBOARD` The Keyboard class (or the internal virtual keyboard) will be used for this Edit
`static byte` | `KBD_NONE` No keyboard will be popped up for this Edit
`static Keyboard` | `keyboard`
`protected String` | `mask` used only to compute the preferred width of this edit.
`static byte` | `NORMAL` to be used in the setMode method
`static String` | `numbersSet` to be used in the setValidChars method
`static byte` | `PASSWORD` to be used in the setMode method.
`static byte` | `PASSWORD_ALL` to be used in the setMode method.
`protected int` | `pushedInsertPos`
`protected int` | `pushedStartSelectPos`
`protected int` | `pushedxOffset`

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`Edit()` Construct an Edit with a default width of 10 chars.
`Edit(String mask)` Construct an Edit with the default width computed based in the specified mask and in the control's font.

Method Summary
`protected int` | `CharPosToX(int n)`
`protected void` | `draw(Graphics g, boolean cursorOnly)`
`String` | `getMask()` Gets the current mask.
`int` | `getPreferredHeight()` Returns the preffered height of this control.
`int` | `getPreferredWidth()` Returns the preffered width of this control.
`String` | `getText()` Returns the text displayed in the edit control.
`protected boolean` | `isCharValid(char c)` Return true if the given char exists in the set of valid characters for this Edit
`boolean` | `isEditable()` Gets if the control accepts input from the user
`protected void` | `onBoundsChanged()` Called after an 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 by the system to pass events to the edit control.
`void` | `onPaint(Graphics g)` Called by the system to draw the edit control.
`protected void` | `onWindowPaintFinished()` Called after the window has finished a paint.
`protected void` | `popPosState()`
`void` | `popupKCC()` user method to popup the keyboard/calendar/calculator for this edit.
`protected void` | `pushPosState()`
`void` | `setCapitaliseMode(byte cap)` Sets the capitalise settings for this Edit.
`void` | `setEditable(boolean on)` Sets if the control accepts input from the user
`void` | `setKeyboard(byte kbd)` Used to change the default keyboard to be used with this Edit control.
`void` | `setMask(String mask)` Sets the current mask to the given one.
`void` | `setMaxLength(int length)` Sets the desired maximum length for text entered in the Edit.
`void` | `setMode(byte mode)` Used to set the valid characters that can be entered by using one of the constants DATE, CURRENCY and NORMAL.
`void` | `setText(String s)` Sets the text displayed in the edit control.
`void` | `setValidChars(String validCharsString)` Sets the valid chars that can be entered in this edit (they are converted to uppercase to make the verification easy). if null is passed, any char can be entered. (case insensitive). added by guich
`protected int` | `XToCharPos(int x)`

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onFontChanged, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Field Detail

### keyboard

    public static Keyboard keyboard

### calendar

    public static Calendar calendar

### calculator

    public static Calculator calculator

### mask

    protected String mask

  used only to compute the preferred width of this edit. If the mask is empty, the edit fills to width.

### hasCursorWhenNotEditable

    public boolean hasCursorWhenNotEditable

  Set to false if you don't want the cursor to blink when the edit is not editable

### KBD_NONE

    public static final byte KBD_NONE

  No keyboard will be popped up for this Edit

### KBD_DEFAULT

    public static final byte KBD_DEFAULT

  The default keyboard for the current mode will be used for this Edit

### KBD_KEYBOARD

    public static final byte KBD_KEYBOARD

  The Keyboard class (or the internal virtual keyboard) will be used for this Edit

### KBD_CALCULATOR

    public static final byte KBD_CALCULATOR

  The Calculator will be used for this Edit

### KBD_CALENDAR

    public static final byte KBD_CALENDAR

  The Calendar will be used for this Edit

### numbersSet

    public static final String numbersSet

  to be used in the setValidChars method

### currencyCharsSet

    public static final String currencyCharsSet

  to be used in the setValidChars method

### dateSet

    public static final String dateSet

  to be used in the setValidChars method

### NORMAL

    public static final byte NORMAL

  to be used in the setMode method

### DATE

    public static final byte DATE

  to be used in the setMode method

### CURRENCY

    public static final byte CURRENCY

  to be used in the setMode method

### PASSWORD

    public static final byte PASSWORD

  to be used in the setMode method. The last char will be always shown

### PASSWORD_ALL

    public static final byte PASSWORD_ALL

  to be used in the setMode method. All chars are replaced by '*'

### ALL_NORMAL

    public static final byte ALL_NORMAL

  to be used in the setCapitaliseMode method

### ALL_UPPER

    public static final byte ALL_UPPER

  to be used in the setCapitaliseMode method

### ALL_LOWER

    public static final byte ALL_LOWER

  to be used in the setCapitaliseMode method

### pushedInsertPos

    protected int pushedInsertPos

### pushedStartSelectPos

    protected int pushedStartSelectPos

### pushedxOffset

    protected int pushedxOffset

Constructor Detail

### Edit

    public Edit()

  Construct an Edit with a default width of 10 chars.

### Edit

    public Edit(String mask)

  Construct an Edit with the default width computed based in the specified mask and in the control's font. Note that the mask does not masks the input. If mask is "", the FILL width is choosen.

Method Detail

### setCapitaliseMode

    public void setCapitaliseMode(byte cap)

  Sets the capitalise settings for this Edit. Use ALL_NORMAL, ALL_UPPER and ALL_LOWER. Text entered will made as is, uppercase or lowercase

### setKeyboard

    public void setKeyboard(byte kbd)

  Used to change the default keyboard to be used with this Edit control. Use the constants KBD_xxxx. Note that setMode calls setKeyboard(KBD_DEFAULT), so be sure to set the mode before calling setKeyboard.

### setMode

    public void setMode(byte mode)

  Used to set the valid characters that can be entered by using one of the constants DATE, CURRENCY and NORMAL. Note that setMode calls setKeyboard(KBD_DEFAULT), so be sure to set the mode before calling setKeyboard.

### setValidChars

    public void setValidChars(String validCharsString)

  Sets the valid chars that can be entered in this edit (they are converted to uppercase to make the verification easy). if null is passed, any char can be entered. (case insensitive). added by guich

### isCharValid

    protected boolean isCharValid(char c)

  Return true if the given char exists in the set of valid characters for this Edit

### setMaxLength

    public void setMaxLength(int length)

  Sets the desired maximum length for text entered in the Edit.
  Since:
    SuperWaba2.0beta4

### pushPosState

    protected void pushPosState()

### popPosState

    protected void popPosState()

### XToCharPos

    protected int XToCharPos(int x)

### CharPosToX

    protected int CharPosToX(int n)

### getText

    public String getText()

  Returns the text displayed in the edit control.

### setText

    public void setText(String s)

  Sets the text displayed in the edit control.

### setEditable

    public void setEditable(boolean on)

  Sets if the control accepts input from the user

### isEditable

    public boolean isEditable()

  Gets if the control accepts input from the user

### onBoundsChanged

    protected void onBoundsChanged()

  Description copied from class: Control
  Called after an setRect.
  Overrides:
    onBoundsChanged in class Control

### getPreferredWidth

    public int getPreferredWidth()

  Description copied from class: Control
  Returns the preffered width of this control.
  Overrides:
    getPreferredWidth in class Control

### getPreferredHeight

    public int getPreferredHeight()

  Description copied from class: Control
  Returns the preffered height of this control.
  Overrides:
    getPreferredHeight in class Control

### 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 Control

### draw

    protected void draw(Graphics g,
                        boolean cursorOnly)

### popupKCC

    public void popupKCC()

  user method to popup the keyboard/calendar/calculator for this edit.

### onEvent

    public void onEvent(Event event)

  Called by the system to pass events to the edit control.
  Overrides:
    onEvent in class Control
  Tags copied from class: Control
  Parameters:
    `event` - the event to process
  See Also:
    `Event`, `KeyEvent`, `PenEvent`

### onWindowPaintFinished

    protected void onWindowPaintFinished()

  Description copied from class: Control
  Called after the window has finished a paint.
  Overrides:
    onWindowPaintFinished in class Control

### onPaint

    public void onPaint(Graphics g)

  Called by the system to draw the edit control.
  Overrides:
    onPaint in class Control
  Tags copied from class: Control
  Parameters:
    `g` - the graphics object for drawing
  See Also:
    `Graphics`

### getMask

    public String getMask()

  Gets the current mask. Note that the mask is currently only used to compute the preferred width of this Edit.

### setMask

    public void setMask(String mask)

  Sets the current mask to the given one. Note that the mask is currently only used to compute the preferred width of this Edit.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD