Skip to content

Latest commit

 

History

History
545 lines (277 loc) · 10.7 KB

PyCListBox.md

File metadata and controls

545 lines (277 loc) · 10.7 KB

PyCListBox

PyCListBox Object

A windows listbox control. Encapsulates an MFC CListBox

class. Derived from a PyCControl object.

Methods

  • AddString

    Add a string to the listbox. 

  • DeleteString

    Delete a string from the listbox. 

  • Dir

    Fill a listbox with a file specification. 

  • GetCaretIndex

    Get the index of the item with the focus rectangle. 

  • GetCount

    Get the count of items in the listbox. 

  • GetCurSel

    Get the current selection in a single selection listbox. 

  • GetItemData

    Retrieves the application-specific object associated with a listbox entry 

  • GetItemValue

    Retrieves the application-specific value associated with a listbox entry 

  • GetSel

    Get the selected items in a multiple selection listbox. 

  • GetSelCount

    Get the number of selected items in a multtiple selection listbox. 

  • GetSelItems

    Get the index of the selected items in a multiple selection listbox. 

  • GetSelTextItems

    Get the text of the selected items in a multiple selection listbox. 

  • GetTopIndex

    Get the index of the topmost item. 

  • GetText

    Get the text associated with an item. 

  • GetTextLen

    Get the length of an item 

  • InsertString

    Insert a string into the listbox. 

  • ResetContent

    Remove all items from a listbox. 

  • SetCaretIndex

    Set the focus rectange to a specified item. 

  • SelectString

    Select an item, based on a string. 

  • SelItemRange

    Select a range of items in a multiple selection listbox. 

  • SetCurSel

    Set the current selection in a single selection listbox. 

  • SetItemData

    Sets the application-specific object associated with a listbox entry 

  • SetItemValue

    Sets the application-specific value associated with a listbox entry 

  • SetSel

    Set the selection. 

  • SetTabStops

    Set the tab stops for a listbox. 

  • SetTopIndex

    Set the top most visible item in a listbox. 

PyCListBox.AddString

int = AddString(object) Adds a string to a listbox.

Parameters

  • object : any

    Any object. If not a string, __str__, __repr__ or a default repr() will be used

MFC References

  • CListBox::AddString

Return Value

The zero based index of the new string.

PyCListBox.DeleteString

int = DeleteString(pos) Deletes an item from a listbox.

Parameters

  • pos : int

    The zero based index of the item to delete.

MFC References

  • CListBox::DeleteString

Return Value

The count of the items remaining in the list.

int = Dir(attr, wild

) Fills a listbox with a directory listing.

Parameters

  • attr : int

    The attributes of the files to locate

  • wild : string

    A file specification string - eg, *.*

MFC References

  • CListBox::Dir

Return Value

The index of the last file name added to the list.

PyCListBox.GetCaretIndex

int = GetCaretIndex() Returns the index of the item which has focus.

Return Value

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.

MFC References

  • CListBox::GetCount

Return Value

Returns the number of items currently in the listbox.

PyCListBox.GetCurSel

int = GetCurSel() Returns the index of the currently selected item.

Comments

Should not be called for a multiple selection listbox.

MFC References

  • CListBox::GetCurSel

PyCListBox.GetItemData

object = GetItemData(item) Retrieves the application-specific object associated with an item.

Parameters

  • 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.

Parameters

  • 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.

Parameters

  • index : int

    The index of the item to return the state for.

MFC References

  • CListBox::GetSel

Return Value

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.

MFC References

  • CListBox::GetSelCount

PyCListBox.GetSelItems

list = GetSelItems() Returns a list of the indexes of the currently selected items in a multiple selection listbox.

MFC References

  • CListBox::GetSelCount

  • CListBox::GetSelItems

PyCListBox.GetSelTextItems

list = GetSelTextItems() Returns a list of the strings of the currently selected items in a multiple selection listbox.

MFC References

  • CListBox::GetSelCount

  • CListBox::GetSelItems

  • CListBox::GetText

PyCListBox.GetText

string = GetText(index) Returns the string for a specified item.

Parameters

  • 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.

Parameters

  • index : int

    The index of the item to retrieve the length of the text.

MFC References

  • CListBox::GetTextLen

PyCListBox.GetTopIndex

int = GetTopIndex() Returns the index of the top most visible item.

MFC References

  • CListBox::GetTopIndex

Return Value

The zero based index of the top most visible item.

PyCListBox.InsertString

int = InsertString(pos, object

) Insert a string into a listbox.

Parameters

  • pos : int

    The zero based index in the listbox to insert the new string

  • object : any

    The object to be added to the listbox

MFC References

  • CListBox::InsertString

Return Value

The zero based index of the new string added.

PyCListBox.ResetContent

ResetContent() Clear all the items from a listbox.

MFC References

  • CListBox::ResetContent

PyCListBox.SelItemRange

SelItemRange(bSel, start, end) Selects an item range.

Parameters

  • 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.

Parameters

  • 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.

MFC References

  • CListBox::SelectString

Return Value

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.

Parameters

  • index : int

    The zero based index of the item.

  • bScroll=1 : int

    Should the listbox scroll to the item?

MFC References

  • CListBox::SetCaretIndex

PyCListBox.SetCurSel

SetCurSel(index) Selects an item in a single selection listbox.

Parameters

  • index : int

    The zero based index of the item to select.

MFC References

  • CListBox::SetCurSel

PyCListBox.SetItemData

int = SetItemData(item, Data

) Sets the item's application-specific object value.

Parameters

  • item : int

    Index of the item whose Data is to be set.

  • Data : object

    New value for the data.

Comments

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.

Parameters

  • 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.

Parameters

  • index : int

    The zero based index of the item to select.

  • bSel=1 : int

    Should the item be selected or deselected?

MFC References

  • CListBox::SetSel

PyCListBox.SetTabStops

SetTabStops(eachTabStop) Sets the tab stops for a listbox.

Parameters

  • eachTabStop : int

    The position for each tab stop.

Alternative Parameters

  • tabStops

    Each individual tab stop.

PyCListBox.SetTopIndex

SetTopIndex(index) Sets the top index (top most visible item) of the listbox.

Parameters

  • index : int

    The zero based index of the item to place at the top of the list.

MFC References

  • CListBox::SetTopIndex