logo

class

fwt::Text

sys::Obj
  fwt::Widget
    fwt::Text
//
// Copyright (c) 2008, Brian Frank and Andy Frank
// Licensed under the Academic Free License version 3.0
//
// History:
//   27 Jul 08  Brian Frank  Creation
//

**
** Text is used to enter and modify text.
**
class Text : Widget
{

  **
  ** Callback when Return/Enter key is pressed in a single
  ** line text editor (not invoked for multiLine)
  **
  |Event| onAction

  **
  ** Callback when the text is modified.
  **
  |Event| onModify

  **
  ** Draw a border around the text field.  Default is true.  This
  ** field cannot be changed once the widget is constructed.
  **
  const Bool border := true

  **
  ** False for text fields and true for multiline text areas.
  ** Default is false.  This field cannot be changed once the widget
  ** is constructed.
  **
  const Bool multiLine := false

  **
  ** True to make wrap the text of a multiLine text widget.
  ** Default is false.  This field cannot be changed once the
  ** widget is constructed.
  **
  const Bool wrap := false

  **
  ** True to make this a password text field which hides the
  ** characters being typed.  Default is false.  This field
  ** cannot be changed once the widget is constructed.
  **
  const Bool password := false

  **
  ** True use a horizontal scrollbar for multiLine text widget.
  ** Default is true.  This field cannot be changed once the
  ** widget is constructed.
  **
  const Bool hscroll := true

  **
  ** True use a vertical scrollbar for multiLine text widget.
  ** Default is true.  This field cannot be changed once the
  ** widget is constructed.
  **
  const Bool vscroll := true

  **
  ** The widget's current text
  **
  Str text
  {
    get { return send(getTextId, null) }
    set { send(setTextId, val) }
  }
  internal static const Str getTextId := "getText"
  internal static const Str setTextId := "setText"

  **
  ** Font for text. Defaults to null (system default).
  **
  Font font := null { set { @font = val; sync(fontId) } }
  internal static const Str fontId := "font"

}