A windows listbox control. Encapsulates an MFC CListBox
class. Derived from a PyCControl object.
-
Add a string to the listbox.
-
Delete a string from the listbox.
-
Fill a listbox with a file specification.
-
Get the index of the item with the focus rectangle.
-
Get the count of items in the listbox.
-
Get the current selection in a single selection listbox.
-
Retrieves the application-specific object associated with a listbox entry
-
Retrieves the application-specific value associated with a listbox entry
-
Get the selected items in a multiple selection listbox.
-
Get the number of selected items in a multtiple selection listbox.
-
Get the index of the selected items in a multiple selection listbox.
-
Get the text of the selected items in a multiple selection listbox.
-
Get the index of the topmost item.
-
Get the text associated with an item.
-
Get the length of an item
-
Insert a string into the listbox.
-
Remove all items from a listbox.
-
Set the focus rectange to a specified item.
-
Select an item, based on a string.
-
Select a range of items in a multiple selection listbox.
-
Set the current selection in a single selection listbox.
-
Sets the application-specific object associated with a listbox entry
-
Sets the application-specific value associated with a listbox entry
-
Set the selection.
-
Set the tab stops for a listbox.
-
Set the top most visible item in a listbox.
PyCListBox.AddString
int = AddString(object) Adds a string to a listbox.
-
object : any
Any object. If not a string, __str__, __repr__ or a default repr() will be used
- CListBox::AddString
The zero based index of the new string.
PyCListBox.DeleteString
int = DeleteString(pos) Deletes an item from a listbox.
-
pos : int
The zero based index of the item to delete.
- CListBox::DeleteString
The count of the items remaining in the list.
PyCListBox.Dir
int = Dir(attr, wild
) Fills a listbox with a directory listing.
-
attr : int
The attributes of the files to locate
-
wild : string
A file specification string - eg, *.*
- CListBox::Dir
The index of the last file name added to the list.
PyCListBox.GetCaretIndex
int = GetCaretIndex() Returns the index of the item which has focus.
The zero-based index of the item that has the focus rectangle in a list box.
If the list box is a single-selection list box, the return value is the index of the item that is selected, if any.
PyCListBox.GetCount
int = GetCount() Returns the count of items in the listbox.
- CListBox::GetCount
Returns the number of items currently in the listbox.
PyCListBox.GetCurSel
int = GetCurSel() Returns the index of the currently selected item.
Should not be called for a multiple selection listbox.
- CListBox::GetCurSel
PyCListBox.GetItemData
object = GetItemData(item) Retrieves the application-specific object associated with an item.
-
item : int
The index of the item whose data is to be retrieved.
PyCListBox.GetItemValue
int = GetItemValue(item) Retrieves the application-specific value associated with an item.
-
item : int
The index of the item whose data is to be retrieved.
PyCListBox.GetSel
int = GetSel(index) Returns the selection state of a specified item.
-
index : int
The index of the item to return the state for.
- CListBox::GetSel
A +ve number if the item is selected, else zero.
PyCListBox.GetSelCount
int = GetSelCount() Returns the number of selected items in a multiple selection listbox.
- CListBox::GetSelCount
PyCListBox.GetSelItems
list = GetSelItems() Returns a list of the indexes of the currently selected items in a multiple selection listbox.
-
CListBox::GetSelCount
-
CListBox::GetSelItems
PyCListBox.GetSelTextItems
list = GetSelTextItems() Returns a list of the strings of the currently selected items in a multiple selection listbox.
-
CListBox::GetSelCount
-
CListBox::GetSelItems
-
CListBox::GetText
PyCListBox.GetText
string = GetText(index) Returns the string for a specified item.
-
index : int
The index of the item to retrieve the text of
PyCListBox.GetTextLen
int = GetTextLen(index) Returns the length of the string for a specified item.
-
index : int
The index of the item to retrieve the length of the text.
- CListBox::GetTextLen
PyCListBox.GetTopIndex
int = GetTopIndex() Returns the index of the top most visible item.
- CListBox::GetTopIndex
The zero based index of the top most visible item.
PyCListBox.InsertString
int = InsertString(pos, object
) Insert a string into a listbox.
-
pos : int
The zero based index in the listbox to insert the new string
-
object : any
The object to be added to the listbox
- CListBox::InsertString
The zero based index of the new string added.
PyCListBox.ResetContent
ResetContent() Clear all the items from a listbox.
- CListBox::ResetContent
PyCListBox.SelItemRange
SelItemRange(bSel, start, end) Selects an item range.
-
bSel : int
Should the selection specified be set or cleared?
-
start : int
The zero based index of the first item to select.
-
end : int
The zero based index of the last item to select.
PyCListBox.SelectString
SelectString(after, string) Searches for a list-box item that matches the specified string, and selects it.
-
after : int
Contains the zero-based index of the item before the first item to be searched, or -1 for the entire listbox.
-
string : string
The string to search for.
- CListBox::SelectString
The return value is always None - an exception is raised if the string can not be located.
PyCListBox.SetCaretIndex
SetCaretIndex(index, bScroll) Sets the focus rectange to a specified item.
-
index : int
The zero based index of the item.
-
bScroll=1 : int
Should the listbox scroll to the item?
- CListBox::SetCaretIndex
PyCListBox.SetCurSel
SetCurSel(index) Selects an item in a single selection listbox.
-
index : int
The zero based index of the item to select.
- CListBox::SetCurSel
PyCListBox.SetItemData
int = SetItemData(item, Data
) Sets the item's application-specific object value.
-
item : int
Index of the item whose Data is to be set.
-
Data : object
New value for the data.
Note that a reference count is not added to the object. This it is your
responsibility to make sure the object remains alive while in the list.
PyCListBox.SetItemValue
int = SetItemValue(item, data
) Sets the item's application-specific value.
-
item : int
Index of the item whose Data is to be set.
-
data : int
New value for the data.
PyCListBox.SetSel
SetSel(index, bSel) Selects an item in a multiple selection listbox.
-
index : int
The zero based index of the item to select.
-
bSel=1 : int
Should the item be selected or deselected?
- CListBox::SetSel
PyCListBox.SetTabStops
SetTabStops(eachTabStop) Sets the tab stops for a listbox.
-
eachTabStop : int
The position for each tab stop.
-
tabStops
Each individual tab stop.
PyCListBox.SetTopIndex
SetTopIndex(index) Sets the top index (top most visible item) of the listbox.
-
index : int
The zero based index of the item to place at the top of the list.
- CListBox::SetTopIndex