class CListBox
__init__(self, parent, text, items, max_sizey = None)

Class CListBox represents a listbox control, a list of text lines zero or one of
which may be selected by the user.  The listbox may have a vertical
scroll bar if all the items do not fit into the space available.

When the user selects an item, an OnListBox(self, control) message is sent
to the parent.  If the user double clicks an item, an OnListBoxDbl(self, control)
message is sent to the parent.

Instance Variables

wpyParent, wpyText, wpyChildList, wpySizeX/Y, wpyLocX/Y

wpySelected, int, readonly after Create()
	The index (0, 1, 2, ...) of the listbox item which is currently
	selected, or -1 if there is no selection.
wpyListBoxItems, list or tuple of strings, readonly after Create()
	The list of strings in the listbox; set by "items" in the
	constructor.  May be changed until Create() is called.
wpyScrollWidth, int, readonly
	The width of the vertical scroll bar were there to be one.
wpyLineHeight, int, readonly
	The height of one line in the listbox.  The total height
	of the listbox is this times the number of lines plus the
	borders.

Methods

__init__(self, parent, text, items, max_sizey = None)
	Return a listbox with self.wpySizeX/Y set according to the arguments given.
	No items are selected (wpySelection == -1).
parent, object
	The view or dialog parent of the control.
text, string
	The name of the listbox (not visible).
items, list
	A list of strings to appear in the listbox.
max_sizey, int or None
	A maximum height (in pixels) for the listbox.  If the
	listbox exceeds this height, then the scrollbar
	size is added to the width, and the height is limited
	to the maximum and rounded to a whole number of lines.
	Otherwise, the listbox width is equal to the largest
	item in the list, and the height just fits all the items.
	A scrollbar may or may not be shown.  This option just
	adds extra width in case it is needed.

Create(self)
	Make the list box visible by calling the underlying GUI.
	NOTE: Create() may slightly alter self.wpySizeY so that the
	listbox is an integral number of lines high.

SetCurSel(self, index)
index, int
	Set the current listbox selection to the index "index".  If index
	is -1, no items are selected.  The current selection is self.wpySelected.

WpySetItems(self, items, select = None)
items, list or tuple of strings
selected, int
	Set the items in the list box to the new list "items".  The old
	items will be replaced.  Select the item with index "select",
	or else no item is selected.

Messages
These messages are sent to the parent of the list box.

OnListBox(self, control)
	Sent when an item in the list box is selected.

OnListBoxDbl(self, control)
	Sent when the user double clicks an item.

Examples

list = ["Red", "Green", "Blue", "Purple", "Orange"]
# Create a listbox, no scroll bar.
CListBox(parent, "colors", list).Create()

# Create a listbox in a space 136 pixels high, add scroll bar if required.
# The height will be about 136 pixels or less, and rounded to a whole number of lines.
CListBox(parent, "colors", list, 136).Create()

# Create a listbox with a scroll bar, set the height to 136 pixels.  The
# actual size may be rounded to prevent partial lines.
s = CListBox(parent, "colors", list, 0)
s.wpySizeY = 136
s.Create()

# Create a custom size listbox.  The list of items is
# long or unknown, so don't take time to create sizes using it.
s = CListBox(parent, "colors", [])
s.wpySizeX = my_size_x
s.wpySizeY = my_size_y
s.wpyListBoxItems = list
s.Create()

# Create a listbox showing three items.
s = CListBox(parent, "colors", list, 0)
s.wpySizeY = s.wpyLineHeight * 3
s.Create()
