Inheritance diagram for wx.VListBox:
wx.VListBox is a listbox-like control with the following two main differences from a regular listbox: it can have an arbitrarily huge number of items because it doesn’t store them itself but uses OnDrawItem callback to draw them (so it is a Virtual listbox) and its items can have variable height as determined by OnMeasureItem (so it is also a listbox with the lines of Variable height).
Also, as a consequence of its virtual nature, it doesn’t have any methods to append or insert items in it as it isn’t necessary to do it: you just have to call SetItemCount to tell the control how many items it should display. Of course, this also means that you will never use this class directly because it has pure virtual functions, but will need to derive your own class, such as wx.HtmlListBox, from it.
However it emits the same events as wx.ListBox and the same event macros may be used with it.
See also
Default constructor.
Parameters:
Returns:
Deselects all the items in the listbox.
Returns True if any items were changed, i.e. if there had been any selected items before, or False if all the items were already deselected.
Returns:
bool
Note
This method is only valid for multi selection listboxes.
Returns the index of the first selected item in the listbox or wx.NOT_FOUND if no items are currently selected.
Here is a typical example of using these functions:
item, cookie = vListBox.GetFirstSelected()
while item != wx.NOT_FOUND:
# ... process item ...
item = vListBox.GetNextSelected(cookie)
Returns:
(item, cookie)
Note
This method is only valid for multi selection listboxes.
Get the number of items in the control.
Returns:
long
See also
Returns the margins used by the control. The x field of the returned point is the horizontal margin and the y field is the vertical one.
Returns:
See also
Returns the index of the next selected item or wx.NOT_FOUND if there are no more.
Parameters:
Returns:
int
Note
This method is only valid for multi selection listboxes.
See also
Returns the number of the items currently selected.
It is valid for both single and multi selection controls. In the former case it may only return 0 or 1 however.
Returns:
long
See also
Get the currently selected item or wx.NOT_FOUND if there is no selection.
Returns:
int
Returns the background colour used for the selected cells. By default the standard system colour is used.
Returns:
Returns True if the listbox was created with wx.LB_MULTIPLE style and so supports multiple selection or False if it is a single selection listbox.
Returns:
bool
Returns True if this item is the current one, False otherwise.
Current item is always the same as selected one for the single selection listbox and in this case this method is equivalent to IsSelected but they are different for multi selection listboxes where many items may be selected but only one (at most) is current.
Parameters:
Returns:
bool
Returns True if this item is selected, False otherwise.
Parameters:
Returns:
bool
This method is used to draw the items background and, maybe, a border around it.
The base class version implements a reasonable default behaviour which consists in drawing the selected item with the standard background colour and drawing a border around the item if it is either selected or current.
Parameters:
This method may be used to draw separators between the lines. The rectangle passed to it may be modified, typically to deflate it a bit before passing to OnDrawItem.
The base class version of this method doesn’t do anything.
Parameters:
Selects or deselects the specified item which must be valid (i.e. not equal to wx.NOT_FOUND).
Return True if the items selection status has changed or False otherwise.
Parameters:
Returns:
bool
Note
This function is only valid for the multiple selection listboxes, use SetSelection for the single selection ones.
Selects all the items in the listbox.
Returns True if any items were changed, i.e. if there had been any unselected items before, or False if all the items were already selected.
Returns:
bool
Note
This method is only valid for multi selection listboxes.
See also
Selects all items in the specified range which may be given in any order.
Return True if the items selection status has changed or False otherwise.
Parameters:
Returns:
bool
Note
This method is only valid for multi selection listboxes.
Set the number of items to be shown in the control.
This is just a synonym for wx.VScrolledWindow.SetLineCount.
Parameters:
Set the margins: horizontal margin is the distance between the window border and the item contents while vertical margin is half of the distance between items.
By default both margins are 0.
Parameters:
Set the margins: horizontal margin is the distance between the window border and the item contents while vertical margin is half of the distance between items.
By default both margins are 0.
Parameters:
Set the selection to the specified item, if it is -1 the selection is unset.
The selected item will be automatically scrolled into view if it isn’t currently visible.
This method may be used both with single and multiple selection listboxes.
Parameters:
Sets the colour to be used for the selected cells background. The background of the standard cells may be changed by simply calling SetBackgroundColour.
Parameters:
See also
Toggles the state of the specified item, i.e. selects it if it was unselected and deselects it if it was selected.
Parameters:
Note
This method is only valid for multi selection listboxes.
See also