Extend this base class to create a combobox with a custom popup
control, and to change the size of the font.
The number of items shown in the combobox can be set using the
shownitems
attribute. If there are more items
available than are shown, a scrollbar will be created
automatically.
The list of items in a combobox can be created explicity using the
<textlistitem>
tags with assigned text and value
attributes.
Example 36. custom appearance and font for a combobox
<canvas
height
="100
">
<font
name
="smallfont
" src
="verity/verity9.ttf
"/>
<class
name
="minicombo
" extends
="basecombobox
" font
="smallfont
" bgcolor
="0xeaeaea
" editable
="false
" height
="14
">
<attribute
name
="text_y
" value
="-2
"/>
<view
bgcolor
="green
" x
="${parent.width-10}
" y
="3
" height
="8
" width
="8
" placement
="bkgnd
" onclick
="parent.toggle()
"/>
</class
>
<class
name
="minilistitem
" extends
="textlistitem
" font
="smallfont
" text_y
="-2
" height
="12
"/>
<minicombo
x
="20
" y
="20
">
<minilistitem
value
="1
">one
</minilistitem
>
<minilistitem
value
="2
">two
</minilistitem
>
<minilistitem
value
="3
">three
</minilistitem
>
</minicombo
>
</canvas
>
For more use cases of <basecombobox>
, see examples
in
<combobox>
.
A dropdown list of selectable items. Can either be editable or
not.
Attributes inherited from <view>
aaactive, aadescription, aaname, aasilent, aatabindex, align, backgroundrepeat, bgcolor, cachebitmap, capabilities, clickable, clickregion, clip, colortransform, context, contextmenu, cornerradius, cursor, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hasdirectionallayout, hassetheight, hassetwidth, height, layout, loadratio, mask, opacity, pixellock, playing, proxyurl, resource, resourceheight, resourcewidth, rotation, shadowangle, shadowblurradius, shadowcolor, shadowdistance, showhandcursor, source, stretches, subviews, tintcolor, totalframes, unstretchedheight, unstretchedwidth, usegetbounds, valign, visibility, visible, width, x, xoffset, xscale, y, yoffset, yscale
Attributes inherited from <node>
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
-
-
basecombobox.addItem(txt : String, val : Object);
Add the specified item to list to the end of the list.
-
-
basecombobox.clearSelection();
Clear the current selection in the list and sets the displayed
text to an empty string
-
-
basecombobox.getItem(value : Object);
Find a particular item by value. This method is not available with
dataoption="lazy" or dataoption="resize" (use data APIs instead).
-
-
basecombobox.getItemAt(index : Number);
Find a particular item by its index. This method not available
with dataoption="lazy" or dataoption="resize"
(use data APIs instead).
-
-
basecombobox.getSelection();
Returns current selection.
-
-
-
-
Get the value for the combobox.
-
-
basecombobox.removeItem(value : Object);
Find the first item with the specified value and remove it from
the list.
-
-
basecombobox.removeItemAt(index : Number);
Remove an item by index (0 based count). This method is not
available with dataoption="lazy" or dataoption="resize"
(use data APIs instead).
-
-
basecombobox.select(item : Object);
Selects a specific item in the list.
-
-
basecombobox.selectItem(value : Object);
Select an item by value. This method is not available with
dataoption="lazy" or dataoption="resize".
-
-
basecombobox.selectItemAt(index : Number);
Select an item by index (0 based count).
-
-
basecombobox.setDefaultSelection(ds : Number);
Sets the number of the item that is initially selected. This overrides
the value defined in the defaulttext attribute.
-
-
basecombobox.setItemclassname(icn : String);
Sets the type of list items which will be created in floatinglist
when necessary.
-
-
basecombobox.setOpen(open : Boolean, withkey : Boolean);
Sets the open/close state of the popup list.
-
-
basecombobox.setText(t : String);
Sets the displayed text. (This isn't an override from LzText)
-
-
basecombobox.toggle(withkey : Boolean);
Toggles the open/close state of the popup list.
Methods inherited from <view>
bringToFront, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getCurrentTime, getDepthList, getDisplayObject, getID3, getMouse, getNextSelection, getPan, getPrevSelection, getProxyURL, getTotalTime, getVolume, init, isBehind, isInFrontOf, isMouseOver, measureHeight, measureWidth, play, proxyurl, searchSubviews, seek, sendAAEvent, sendBehind, sendInFrontOf, sendToBack, setAccessible, setAttributeRelative, setColor, setColorTransform, setPan, setProxyPolicy, setSource, setVolume, shouldYieldFocus, stop, unload, updateResourceSize
Methods inherited from <node>
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events inherited from <view>
onaddsubview, onbackgroundrepeat, onblur, onclick, onclickable, onclip, oncontext, oncornerradius, ondblclick, onerror, onfocus, onframe, onframesloadratio, ongesture, onheight, onkeydown, onkeyup, onlastframe, onload, onloadratio, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmousetrackout, onmousetrackover, onmousetrackup, onmouseup, onmouseupoutside, onopacity, onplay, onplaying, onremovesubview, onshadowangle, onshadowblurradius, onshadowcolor, onshadowdistance, onstop, ontimeout, ontouch, onvisible, onwidth, onx, ony