logo

class

fwt::Combo

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

**
** Combo is a combination of a text field and a list drop down.
**
class Combo : Widget
{

  **
  ** Callback when Return/Enter key is pressed.
  **
  |Event| onAction

  **
  ** Callback when either the text field or item is changed.
  **
  |Event| onModify

  **
  ** If true then the list is displayed in a drop down
  ** window.  If false then the list is displayed directly
  ** under the text field.  Default is true.
  **
  const Bool dropDown := true

  **
  ** Set to true to display editing of the combo's text field.
  **
  const Bool editable := false

  **
  ** 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"

  **
  ** The list selection items displayed via 'Obj.toStr'.
  ** Defaults to the empty list.
  **
  Obj[] items := Obj[,] { set { @items = val.ro; sync(itemsId) } }
  internal static const Str itemsId := "items"

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

}