Interface TextFieldOwner
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface TextFieldOwner

public interface netscape.application.TextFieldOwner
{
    /* Fields
     */
    public final static int BACKTAB_KEY;
    public final static int LOST_FOCUS;
    public final static int RESIGNED_FOCUS;
    public final static int RETURN_KEY;
    public final static int TAB_KEY;

    /* Methods
     */
    public abstract void textEditingDidBegin(TextField);
    public abstract void textEditingDidEnd(TextField, int, boolean);
    public abstract boolean textEditingWillEnd(TextField, int, boolean);
    public abstract void textWasModified(TextField);
}
Interface implemented by objects wanting information on important TextField events, such as when editing has completed. An object implementing this interface must make itself the TextField's owner using the TextField's setOwner() method.

Fields

TAB_KEY

  public final static int TAB_KEY
Edit mode will end (or did end) because the TextField received a Tab key.

BACKTAB_KEY

  public final static int BACKTAB_KEY
Edit mode will or did end because the TextField received a BackTab key.

RETURN_KEY

  public final static int RETURN_KEY
Edit mode will or did end because the TextField received a Return key.

LOST_FOCUS

  public final static int LOST_FOCUS
Edit mode will or did end because another TextField acquired key focus.

RESIGNED_FOCUS

  public final static int RESIGNED_FOCUS
Edit mode will or did end because the TextField resigned key focus.

Methods

textEditingDidBegin

  public abstract void textEditingDidBegin(TextField textField)
Sent by textField upon entering edit mode.

textWasModified

  public abstract void textWasModified(TextField textField)
Sent by textField each time the user changes the textField's contents.

textEditingWillEnd

  public abstract boolean textEditingWillEnd(TextField textField,
                                             int endCondition,
                                             boolean contentsChanged)
Sent by textField when it is about to complete editing. endCondition describes why editing will end, with the possible values TAB_KEY, BACKTAB_KEY, RETURN_KEY, LOST_FOCUS, and RESIGNED_FOCUS. For TAB_KEY, BACKTAB_KEY, and RETURN_KEY, returning false causes the TextField to remain in edit mode, and returning true allows editing to complete. With the LOST_FOCUS and RESIGNED_FOCUS conditions, the TextField exits edit mode regardless of the return value (when another TextField requests input focus, or the TextField resigns it voluntarily, there's no way to prevent it). contentsChanged is true if the TextField's contents have been modified since entering edit mode.

textEditingDidEnd

  public abstract void textEditingDidEnd(TextField textField,
                                         int endCondition,
                                         boolean contentsChanged)
Sent by textField when text editing has completed. endCondition describes why editing ended, with the possible values TAB_KEY, BACKTAB_KEY, RETURN_KEY, LOST_FOCUS, and RESIGNED_FOCUS. contentsChanged is true if the TextField's contents were modified since entering edit mode.

If you need to implement special behavior when the user switches TextFields using keystrokes (Tab, Return, and so on), do it in this method. For example, if you need to determine which TextField should receive keys next without using TextField's existing setTabField() and setBacktabField() methods, you could use the following code for this method:

    if (endCondition == TextFieldOwner.RETURN_KEY) {
        field1.selectText();
    } else if (endCondition == TextFieldOwner.TAB_KEY) {
        field2.selectText();
    } else if (endCondition == TextFieldOwner.BACKTAB_KEY) {
        field3.selectText();
    }

All Packages  Class Hierarchy  This Package  Previous  Next  Index