Name
basedatacombobox — baseclass for a datacombobox
Description
An abstract class to create dropdown lists of selectable items. Define
the look in a subclass. Also, a basedatacombobox_text must be declared in
the subclass.
** Caveat: Combobox items will not update if the attributes
that are mapped to textdatapath or valuedatapath change.
To force the changes to update, call
node.parentNode.replaceChild(node.cloneNode(true), node)
where node is the dataelement of the list item. Don't forget
to reset the seleciton on the list, as well.
Details
Properties (15)
-
defaulttext
-
<attribute name="defaulttext" type="string" value="$once{null}" />
public var defaulttext : String;
Default text to display before a selection is made. No default
item is selected if defaulttext is set. Defaulttext is replaced
with selected item's text.
-
ismenu
-
<attribute name="ismenu" value="false" />
If true, the combobox will behave like a menu. "value" is
ignored, and items will not remain selected. Selecting an
item generates an onselect event
-
isopen
-
<attribute name="isopen" value="false" />
Indicates whether or not the popup list is showing.
-
itemclassname
-
<attribute name="itemclassname" type="string" value="" />
public var itemclassname : String;
The name of the class for items in the floating list.
-
itemdatapath
-
<attribute name="itemdatapath" type="string" value="null" />
public var itemdatapath : String;
Datapath to items in list.
-
listattach
-
<attribute name="listattach" type="string" value="bottom" />
public var listattach : String;
Where the floatinglist should attach to its owner. Possible
values: bottom, top, left, right. In the event of a canvas
out-of-bounds, the floating list will attach in a visible
location.
default: bottom
-
listwidth
-
<attribute name="listwidth" value="null" />
Width of popup list, defaults to width of combobox view. During
setup, the width of the floating list view might not yet be set,
so this returns the expected width. If not set,
-
menuclassname
-
<attribute name="menuclassname" type="string" value="" />
public var menuclassname : String;
-
selected
-
<attribute name="selected" value="null" />
public read-only var selected;
Datapointer to selected item.
-
selectfirst
-
<attribute name="selectfirst" value="true" />
When true, the 1st item is selected oninit.
-
shownitems
-
<attribute name="shownitems" value="4" />
Sets the height to the number of items to show in combobox
popup list. Default is 4, must be greater than 0.
-
statictext
-
<attribute name="statictext" type="string" value="$once{null}" />
public var statictext : String;
If set, this will always be displayed instead of selected item
text. Behaves like a menu button. Also see defaulttext.
-
textdatapath
-
<attribute name="textdatapath" type="string" value="text()" />
public var textdatapath : String;
Datapath to text to display for items in list.
See caveat.
-
value
-
<attribute name="value" value="null" />
The value of the selected item.
-
valuedatapath
-
<attribute name="valuedatapath" type="string" value="@value" />
public var valuedatapath : String;
Datapath to value for items in list. See caveat.
Methods (8)
-
getItemIndex()
-
<method name="getItemIndex" args="value" />
public function getItemIndex(value : Object);
Get item's index by value. Note: If you have a stray character in
dataset, this will break. CDATA is included in nodes.length.
-
getValue()
-
<method name="getValue" />
public function getValue();
Override getValue because we don't want to return this.text
if this.value is null (this.text may be the defaulttext)
-
selectItem()
-
<method name="selectItem" args="value" />
public function selectItem(value : Object);
-
selectItemAt()
-
<method name="selectItemAt" args="index" />
public function selectItemAt(index : Number);
-
setChanged()
-
<method name="setChanged" args="isChanged" />
public function setChanged(isChanged : Boolean);
Setter to set baseformitem to changed. Should be called by
subclasses whenever a value is set. The first time this is called,
the changed value is not set since it assumes subclasses are
setting their initial value.
This also updates the selected value in the combobox to reflect
the new value (in case it was changed).
-
setOpen()
-
<method name="setOpen" args="open" />
public function setOpen(open : Boolean);
Sets the open/close state of the popup list.
-
setValue()
-
<method name="setValue" args="value, isinitvalue, ignoreselection" />
public function setValue(value, isinitvalue : Boolean, ignoreselection);
-
toggle()
-
public function toggle();
Toggles the open/close state of the popup list.
Events (5)
-
oncomboblur
-
<attribute name="oncomboblur" />
public event oncomboblur;
The equivalent for onblur for combobox.
-
oncombofocus
-
<attribute name="oncombofocus" />
public event oncombofocus;
The equivalent for onfocus for combobox.
-
onisopen
-
<attribute name="onisopen" />
Called when combobox opens or closes
-
onselect
-
<attribute name="onselect" />
Event sent when an item is selected. Sends selected item.
-
onselected
-
<attribute name="onselected" />
Event sent when an item is selected. Sends selected item.
LZX Synopsis
<class name="
basedatacombobox" extends="
baseformitem
">
<attribute name="
defaulttext
" type="
string" value="
$once{null}" />
<attribute name="
ismenu
" value="
false" />
<attribute name="
isopen
" value="
false" />
<attribute name="
itemdatapath
" type="
string" value="
null" />
<attribute name="
listattach
" type="
string" value="
bottom" />
<attribute name="
listwidth
" value="
null" />
<attribute name="
selected
" value="
null" />
<attribute name="
statictext
" type="
string" value="
$once{null}" />
<attribute name="
textdatapath
" type="
string" value="
text()" />
<attribute name="
value
" value="
null" />
<attribute name="
valuedatapath
" type="
string" value="
@value" />
<method name="
setOpen
" args="
open" />
<method name="
setValue
" args="
value,
isinitvalue,
ignoreselection" />
</class>
JavaScript Synopsis
public
basedatacombobox extends
baseformitem
{
prototype public function
selectItem
(
value : Object);
prototype public function
setChanged
(
isChanged : Boolean);
prototype public function
setOpen
(
open : Boolean);
prototype public function
setValue
(
value,
isinitvalue : Boolean,
ignoreselection);
prototype public function
toggle
();
}