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 (19)
-
_cblist
-
<attribute name="_cblist" value="null" />
-
_cbtext
-
<attribute name="_cbtext" value="null" />
The text label within the subclass.
This value must be set by subclasses of basedatacombobox.
-
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;
-
_selectdel
-
<attribute name="_selectdel" value="null" />
-
selected
-
<attribute name="selected" value="null" />
public read-only var selected;
Datapointer to selected item.
-
_selectedIndex
-
<attribute name="_selectedIndex" value="-1" />
private var _selectedIndex;
If set, it represents the index of what should be selected in the
floating list.
-
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 (18)
-
_dokeydown()
-
<method name="_dokeydown" args="key" />
private function _dokeydown(key);
-
_flistselect()
-
<method name="_flistselect" args="item" />
private function _flistselect(item);
This method listens for the onselect event from the floating list
and then calls setValue, which indirectly sends an onselect event
to the datacombobox.
-
_getItemAt()
-
<method name="_getItemAt" args="index" />
private function _getItemAt(index : Number) : Object;
Find a particular item by its index. This routine only works when the
_cblist is attached and data mapped.
-
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.
-
getNextSelection()
-
<method name="getNextSelection" />
private function getNextSelection();
Since we are not focusable, defer to the datacombobox's next selection,
so that when floatinglist is tabbed out of, we can provide a next
selection since we are it's owner
-
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)
-
init()
-
-
passModeEvent()
-
<method name="passModeEvent" args="eventStr, view" />
private function passModeEvent(eventStr, view);
-
resolveSelection()
-
<method name="resolveSelection" />
private function resolveSelection();
since we are not focusable, this provides an api for asking what child to send focus
to, as is the case when floatinglist is shift-tabbed back to us.
-
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.
-
_setupcblist()
-
<method name="_setupcblist" args="force" />
private function _setupcblist(force);
-
setValue()
-
<method name="setValue" args="value, isinitvalue, ignoreselection" />
public function setValue(value, isinitvalue : Boolean, ignoreselection);
-
_teardowncblist()
-
<method name="_teardowncblist" />
private function _teardowncblist();
-
toggle()
-
public function toggle();
Toggles the open/close state of the popup list.
-
_updateSelectionByIndex()
-
<method name="_updateSelectionByIndex" args="index, dontSetValue, isinitvalue" />
private function _updateSelectionByIndex(index : Number, dontSetValue : Boolean, isinitvalue : Boolean);
Updates the combobox text and 'selected' attribute. Called when an
item is selected.
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="
lz.basedatacombobox" extends="
lz.baseformitem
">
<attribute name="
_cblist
" value="
null" />
<attribute name="
_cbtext
" value="
null" />
<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
lz.basedatacombobox extends
lz.baseformitem
{
prototype private function
_getItemAt
(
index : Number) :
Object;
prototype private function
init
();
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
();
prototype private function
_updateSelectionByIndex
(
index : Number,
dontSetValue : Boolean,
isinitvalue : Boolean);
}