TKSelect Class Reference
[Form Elements]

Represents a dropdown ("combo-box") or list selector. More...

Inheritance diagram for TKSelect:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ($name, $multiple=false, $size=0)
 Creates a new select box.
 addOption ($value, $label)
 Adds an item/option to the select box.
 getOptions ()
 Returns a list of all the options that have been added so far.
 getSelectedIndex ()
 Returns the numerical index of the initially selected item.
 makeString ($prop, $newValue)
 INSERT BRIEF DESCRIPTION HERE.


Detailed Description

Represents a dropdown ("combo-box") or list selector.

This class corresponds to the HTML select tag. It also has supports for events that are triggered when changing the selection. When used in TK XML, each item is specified with a <item> tag, which must have a 'value' attribute. The content of the tag is used as the label, or display value. If there is a 'selected' attribute on the item tag and the value of the attribute is 'true', then the item is set as the initially selected item. Should there be multiple item tags with a 'selected="true"' attribute, only the last one will count.

Properties:
  • selected string: name of initially selected element
  • multiple boolean: if true, then a multi-select box is used, otherwise a drop-down is used

Events:
  • onselectX: emitted when item X (numeric index of item) is selected by the user
  • ondeselectX: emitted when item X (numeric index of item) is deselected by the user


Constructor & Destructor Documentation

TKSelect::__construct ( name,
multiple = false,
size = 0 
)

Creates a new select box.

Parameters:
$name [string]: form element name
$multiple [boolean]: whether to have multi-select (true) or drop-down (false)
$size [int]: if $multiple is true, the number of rows in the selector box


Member Function Documentation

TKSelect::addOption ( value,
label 
)

Adds an item/option to the select box.

The value is what the whole select element is set to when the user submits the form. The label is what is displayed to the user for that item.

Parameters:
$value [string]: item value
$label [string]: what the user sees

TKSelect::getOptions (  ) 

Returns a list of all the options that have been added so far.

Returns:
[array]: options added so far

TKSelect::getSelectedIndex (  ) 

Returns the numerical index of the initially selected item.

Returns:
[numeric]: index of initially selected item

TKSelect::makeString ( prop,
newValue 
)

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Parameters:
$prop [TYPE]: DESCRIPTION
$newValue [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:04:30 2010 for Common by  doxygen 1.5.6