Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class AwtUIEdit

public class AwtUIEdit extends AwtUIControl
{
  // Constructors
  public AwtUIEdit();
  public AwtUIEdit(String newBuff);
  public AwtUIEdit(char newBuff[]);

  // Methods
  public void addActionListener(ActionListener l);
  public void addTextListener(TextListener l);
  public int append(char key);
  public void clear();
  public IUIComponent getBase();
  public int getCharFromScreen(int scrnX, int scrnY);
  public int getCharFromScreen(Point scrnPos);
  public Point getCharLocation(int iPos);
  public int getLength();
  public int getMaxBufferSize();
  public IFxShape getOutline();
  public char getPasswordChar();
  public String getSelectedText();
  public String getText();
  public int getWordWrap();
  public int insert(char key, int iPos);
  public boolean isAutoResizable();
  public boolean isBordered();
  public boolean isReadOnly();
  public boolean isSingleLine();
  protected void processActionEvent(ActionEvent e);
  protected void processHostEvent(AWTEvent e);
  protected void processTextEvent(TextEvent e);
  public void remove(int iPos, int numberToRemove);
  public synchronized void removeActionListener(ActionListener l);
  public synchronized void removeTextListener(TextListener l);
  public void selectAll();
  public void setAutoResizable(boolean auto);
  public void setBordered(boolean b);
  public void setHorizAlign(int h);
  public void setMaxBufferSize(int newMax);
  public void setOutline(IFxShape outline);
  public void setPasswordChar(char c);
  public void setReadOnly(boolean ro);
  public void setRefresh(boolean r);
  public void setSingleLine(boolean sl);
  public void setText(String s);
  public void setText(char newBuff[], int offset, int len);
  public void setVertAlign(int v);
  public void setWordWrap(int ww);
  public void showCaret();
  public void showCaret(int iPos);
  public boolean tabbable();
}

This class implements the functionality of a UIEdit object in an AWT-based control. An AwtUIEdit control is an AwtUIHost component whose associated root container holds a UIEdit object. By hosting this object, an AwtUIEdit control integrates AFC with AWT. Although an AwtUIEdit control is fully compatible with AWT, a UIEdit control is optimized for performance and size.

Panel
  |
  +--AwtUIHost
    |
    +--AwtUIControl
      |
      +--AwtUIEdit

Constructors

AwtUIEdit

public AwtUIEdit();

Creates an empty AWT-based edit control.

AwtUIEdit

public AwtUIEdit(String newBuff);

Creates an AWT-based edit control with the specified string.

ParameterDescription
newBuff The text of the control.

AwtUIEdit

public AwtUIEdit(char newBuff[]);

Creates an AWT-based edit control with the specified character buffer.

ParameterDescription
newBuff The text of the control.

Methods

addActionListener

public void addActionListener(ActionListener l);

Adds the specified action listener. The listener receives all action events generated for the control.

Return Value:

No return value.

ParameterDescription
l The action listener to be added.

See Also: removeActionListener

addTextListener

public void addTextListener(TextListener l);

Adds the specified text listener. The listener receives all text events generated for the control.

Return Value:

No return value.

ParameterDescription
l The text listener to be added.

See Also: removeTextListener

append

public int append(char key);

Appends a character to the end of the text in the control.

Return Value:

Returns the number of characters added.

ParameterDescription
key The character to be appended.

clear

public void clear();

Deletes all the text from the edit control.

Return Value:

No return value.

getBase

public IUIComponent getBase();

Retrieves the UI component that the control is based on.

Return Value:

Returns the UIEdit object associated with the control.

Remarks:

When the AWT-based control is first created, it is associated with a UIEdit object.

getCharFromScreen

public int getCharFromScreen(int scrnX, int scrnY);

Retrieves the character at the specified coordinates.

Return Value:

Returns the index of the character at the specified position. If there is no character at that position, the character returned will be the last one on the nearest line.

ParameterDescription
scrnX The x coordinate, in pixels.
scrnY The y coordinate, in pixels.

getCharFromScreen

public int getCharFromScreen(Point scrnPos);

Retrieves the character at the specified point.

Return Value:

Returns the index of the character at the specified position. If there is no character at that position, the character returned will be the last one on the nearest line.

ParameterDescription
scrnPos The coordinates of the point, in pixels.

getCharLocation

public Point getCharLocation(int iPos);

Retrieves the position that the character would be drawn at if drawn alone. This is typically used for placing the caret.

Return Value:

Returns a Point object that contains the client coordinates of the character.

ParameterDescription
iPos The index of the character to query.

getLength

public int getLength();

Retrieves the length of the text in the control.

Return Value:

Returns the number of characters in the control.

getMaxBufferSize

public int getMaxBufferSize();

Retrieves the maximum number of characters that the control can hold.

Return Value:

Returns the maximum number of characters that the control can hold.

getOutline

public IFxShape getOutline();

Retrieves the outline along which text is drawn. For example, if the outline is an ellipse, the text that the AwtUIEdit object is created with is drawn along the outline of the ellipse.

Return Value:

Returns an IFxShape object that specifies the outline.

See Also: setOutline

getPasswordChar

public char getPasswordChar();

Retrieves the character that the control displays for password characters.

Return Value:

Returns the character that the control displays for password characters.

getSelectedText

public String getSelectedText();

Retrieves the selected text in the control.

Return Value:

Returns a String object that contains the selected text of the control.

getText

public String getText();

Retrieves the text in the control.

Return Value:

Returns a String object that contains the text of the control.

getWordWrap

public int getWordWrap();

Retrieves the word wrap style.

Return Value:

Returns the word wrap style. For a list of possible values, see setWordWrap.

insert

public int insert(char key, int iPos);

Inserts a character into the text in the control at the specified position.

Return Value:

Returns the number of characters inserted.

ParameterDescription
key The character to be inserted.
iPos The character index where the character will be inserted.

isAutoResizable

public boolean isAutoResizable();

Determines whether the bounding box of the control's text will automatically adjust to the size of the control when the control is resized or reshaped.

Return Value:

Returns true if the auto-resize attribute is set; otherwise, returns false.

See Also: setAutoResizable

isBordered

public boolean isBordered();

Determines whether the control has a border.

Return Value:

Returns true if the control has a border; otherwise, returns false.

See Also: setBordered

isReadOnly

public boolean isReadOnly();

Determines whether the control is read-only.

Return Value:

Returns true if the READONLY style is set; otherwise, returns false.

isSingleLine

public boolean isSingleLine();

Retrieves the control's single line attribute.

Return Value:

Returns false if the control text can be displayed on multiple lines; otherwise, returns true.

processActionEvent

protected void processActionEvent(ActionEvent e);

Processes action events.

Return Value:

No return value.

ParameterDescription
e The action event.

Remarks:

This method is called by processHostEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processActionEvent to ensure the default event processing continues normally.

See Also: addActionListener

processHostEvent

protected void processHostEvent(AWTEvent e);

Processes the specified event.

Return Value:

No return value.

ParameterDescription
e The event.

Remarks:

This method is automatically invoked if a listener has has been registered through a call to addsXXXListener. Depending on the type of event, processHostEvent calls one of the following methods.

Event type Method called
action event processActionEvent
text event processTextEvent
component event processComponentEvent (inherited through AwtUIHost)
container event processContainerEvent (inherited through AwtUIHost)
focus event processFocusEvent (inherited through AwtUIHost)
key event processKeyEvent (inherited through AwtUIHost)
mouse event processMouseEvent (inherited through AwtUIHost)
mouse motion event processMouseMotionEvent (inherited through AwtUIHost)

When overriding processHostEvent, call the super method processHostEvent to ensure the default event processing continues normally.

processTextEvent

protected void processTextEvent(TextEvent e);

Processes text events.

Return Value:

No return value.

ParameterDescription
e The text event.

Remarks:

This method is called by processHostEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processTextEvent to ensure the default event processing continues normally.

See Also: addTextListener

remove

public void remove(int iPos, int numberToRemove);

Deletes one or more characters from the edit control.

Return Value:

No return value.

ParameterDescription
iPos The character index where the characters will be deleted.
numberToRemove The number of characters that will be deleted.

removeActionListener

public synchronized void removeActionListener(ActionListener l);

Removes the specified action listener. The listener no longer receives the control's action events.

Return Value:

No return value.

ParameterDescription
l The action listener to be removed.

See Also: addActionListener

removeTextListener

public synchronized void removeTextListener(TextListener l);

Removes the specified text listener. The listener no longer receives the control's text events.

Return Value:

No return value.

ParameterDescription
l The text listener to be removed.

See Also: addTextListener

selectAll

public void selectAll();

Selects all of the text in the control.

Return Value:

No return value.

setAutoResizable

public void setAutoResizable(boolean auto);

Sets the control's auto-resize attribute.

Return Value:

No return value.

ParameterDescription
auto If true, the bounding box of the control's text will automatically adjust to the size of the control when the control is resized or reshaped.

See Also: isAutoResizable

setBordered

public void setBordered(boolean b);

Sets or clears the control's border.

Return Value:

No return value.

ParameterDescription
b If true, the control has a border; otherwise, it does not.

See Also: isBordered

setHorizAlign

public void setHorizAlign(int h);

Sets the horizontal alignment of the control's text.

Return Value:

No return value.

ParameterDescription
h The horizontal alignment. You can pass one of the following values, defined by the IFxTextConstants interface.

setMaxBufferSize

public void setMaxBufferSize(int newMax);

Sets the maximum number of characters that the control can hold.

Return Value:

No return value.

ParameterDescription
newMax The new maximum number of characters that the control can hold.

setOutline

public void setOutline(IFxShape outline);

Sets an outline that the text buffer is drawn along.

Return Value:

No return value.

ParameterDescription
outline An IFxShape object that specifies the outline.

See Also: getOutline

setPasswordChar

public void setPasswordChar(char c);

Sets the character that is displayed in the control when a password is entered.

Return Value:

No return value.

ParameterDescription
c The character that will be displayed in place of password characters. If the value is zero, the password character is cleared.

setReadOnly

public void setReadOnly(boolean ro);

Changes the read-only attribute of the control.

Return Value:

No return value.

ParameterDescription
ro If true, the READONLY style is set; otherwise, it is cleared.

setRefresh

public void setRefresh(boolean r);

Sets the refresh flag.

Return Value:

No return value.

ParameterDescription
r If true, the control will update itself whenever a parameter is changed. If false, the control will not update itself.

setSingleLine

public void setSingleLine(boolean sl);

Changes the control's single line attribute.

Return Value:

No return value.

ParameterDescription
sl Set to false if the control's text is displayed on multiple lines. Otherwise, the text is displayed on a single line.

setText

public void setText(String s);

Sets the text in the control.

Return Value:

No return value.

ParameterDescription
s A String object that specifies the new text.

setText

public void setText(char newBuff[], int offset, int len);

Replaces the text in the sentence with the specified array of characters.

Return Value:

No return value.

ParameterDescription
newBuff The array of characters to replace the text with.
offset The offset to use.
len The length of the array used.

setVertAlign

public void setVertAlign(int v);

Sets the vertical alignment of the control's text.

Return Value:

No return value.

ParameterDescription
v The vertical alignment. You can pass one of the following values, defined by the IFxTextConstants interface.

setWordWrap

public void setWordWrap(int ww);

Sets the word wrap style.

Return Value:

No return value.

ParameterDescription
ww The word wrap style. You can pass one of the following values, defined by the IFxTextConstants interface.

showCaret

public void showCaret();

Shows the caret at the current position.

Return Value:

No return value.

showCaret

public void showCaret(int iPos);

Positions and displays the caret at the specified position.

Return Value:

No return value.

ParameterDescription
iPos The character index where the caret will be positioned.

tabbable

public boolean tabbable();

Determines whether the control can be navigated to by pressing the TAB key.

Return Value:

Returns true if the control can be tabbed to; otherwise, returns false.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.