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.

Static Public Member Functions

static createFromXML ($attrs, $contents, $node)

Protected Member Functions

 renderComponent ($class, $style, $events, $id)


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

Definition at line 23 of file TKSelect.php5.


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

Definition at line 35 of file TKSelect.php5.

References TKComponent::addProperty(), TKComponent::setAction(), and TKComponent::setPropChangeListener().


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

Definition at line 78 of file TKSelect.php5.

References TKComponent::addEvent().

static TKSelect::createFromXML ( attrs,
contents,
node 
) [static]

For internal use only.

Reimplemented from TKFormElement.

Definition at line 147 of file TKSelect.php5.

TKSelect::getOptions (  ) 

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

Returns:
[array]: options added so far

Definition at line 94 of file TKSelect.php5.

TKSelect::getSelectedIndex (  ) 

Returns the numerical index of the initially selected item.

Returns:
[numeric]: index of initially selected item

Definition at line 103 of file TKSelect.php5.

TKSelect::makeString ( prop,
newValue 
)

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

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

Definition at line 59 of file TKSelect.php5.

TKSelect::renderComponent ( class,
style,
events,
id 
) [protected]

For internal use only.

Reimplemented from TKComponent.

Definition at line 119 of file TKSelect.php5.

References TKFormElement::getStandardProperties().


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

Generated on Wed Nov 24 02:07:05 2010 for Common by  doxygen 1.5.6