Package wx :: Class ItemContainer
[frames | no frames]

Type ItemContainer

object --+
         |
        ItemContainer

Known Subclasses:
ComboBox, ControlWithItems, OwnerDrawnComboBox, SimpleHtmlListBox

The wx.ItemContainer class defines an interface which is implemented by all controls which have string subitems, each of which may be selected, such as wx.ListBox, wx.CheckListBox, wx.Choice as well as wx.ComboBox which implements an extended interface deriving from this one.

It defines the methods for accessing the control's items and although each of the derived classes implements them differently, they still all conform to the same interface.

The items in a wx.ItemContainer have (non empty) string labels and, optionally, client data associated with them.


Method Summary
  __init__(self)
int Append(self, item, clientData)
Adds the item to the control, associating the given data with the item if not None.
  AppendItems(self, strings)
Apend several items at once to the control.
  Clear(self)
Removes all items from the control.
  Delete(self, n)
Deletes the item at the zero-based index 'n' from the control.
int FindString(self, s)
Finds an item whose label matches the given string.
PyObject GetClientData(self, n)
Returns the client data associated with the given item, (if any.)
int GetCount(self)
Returns the number of items in the control.
  GetItems(self)
Return a list of the strings in the control
int GetSelection(self)
Returns the index of the selected item or wx.NOT_FOUND if no item is selected.
String GetString(self, n)
Returns the label of the item with the given index.
wxArrayString GetStrings(self)
String GetStringSelection(self)
Returns the label of the selected item or an empty string if no item is selected.
int Insert(self, item, pos, clientData)
Insert an item into the control before the item at the pos index, optionally associating some data object with the item.
bool IsEmpty(self)
Returns True if the control is empty or False if it has some items.
  Select(self, n)
This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection.
  SetClientData(self, n, clientData)
Associate the given client data with the item at position n.
  SetItems(self, items)
Clear and set the strings in the control from a list
  SetSelection(self, n)
Sets the item at index 'n' to be the selected item.
  SetString(self, n, s)
Sets the label for the given item.
bool SetStringSelection(self, s)

Property Summary
  Count: See GetCount
  Items: See GetItems and SetItems
  Selection: See GetSelection and SetSelection
  Strings: See GetStrings
  StringSelection: See GetStringSelection and SetStringSelection
  thisown: The membership flag

Method Details

Append(self, item, clientData=None)

Adds the item to the control, associating the given data with the item if not None. The return value is the index of the newly added item which may be different from the last one if the control is sorted (e.g. has wx.LB_SORT or wx.CB_SORT style).

Parameters:
item
           (type=String)

clientData
           (type=PyObject)

Returns:
int

AppendItems(self, strings)

Apend several items at once to the control. Notice that calling this method may be much faster than appending the items one by one if you need to add a lot of items.

Parameters:
strings
           (type=List)

Clear(self)

Removes all items from the control.

Delete(self, n)

Deletes the item at the zero-based index 'n' from the control. Note that it is an error (signalled by a wx.PyAssertionError exception if enabled) to remove an item with the index negative or greater or equal than the number of items in the control.

Parameters:
n
           (type=int)

FindString(self, s)

Finds an item whose label matches the given string. Returns the zero-based position of the item, or wx.NOT_FOUND if the string was not found.

Parameters:
s
           (type=String)

Returns:
int

GetClientData(self, n)

Returns the client data associated with the given item, (if any.)

Parameters:
n
           (type=int)

Returns:
PyObject

GetCount(self)

Returns the number of items in the control.

Returns:
int

GetItems(self)

Return a list of the strings in the control

GetSelection(self)

Returns the index of the selected item or wx.NOT_FOUND if no item is selected.

Returns:
int

GetString(self, n)

Returns the label of the item with the given index.

Parameters:
n
           (type=int)

Returns:
String

GetStringSelection(self)

Returns the label of the selected item or an empty string if no item is selected.

Returns:
String

Insert(self, item, pos, clientData=None)

Insert an item into the control before the item at the pos index, optionally associating some data object with the item.

Parameters:
item
           (type=String)

pos
           (type=int)

clientData
           (type=PyObject)

Returns:
int

IsEmpty(self)

Returns True if the control is empty or False if it has some items.

Returns:
bool

Select(self, n)

This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection.

Parameters:
n
           (type=int)

SetClientData(self, n, clientData)

Associate the given client data with the item at position n.

Parameters:
n
           (type=int)

clientData
           (type=PyObject)

SetItems(self, items)

Clear and set the strings in the control from a list

SetSelection(self, n)

Sets the item at index 'n' to be the selected item.

Parameters:
n
           (type=int)

SetString(self, n, s)

Sets the label for the given item.

Parameters:
n
           (type=int)

s
           (type=String)


Property Details

Count

See GetCount

Get Method:
GetCount(self)

Items

See GetItems and SetItems

Get Method:
GetItems(self)
Set Method:
SetItems(self, items)

Selection

See GetSelection and SetSelection

Get Method:
GetSelection(self)
Set Method:
SetSelection(self, n)

Strings

See GetStrings

Get Method:
GetStrings(self)

StringSelection

See GetStringSelection and SetStringSelection

Get Method:
GetStringSelection(self)
Set Method:
SetStringSelection(self, s)

thisown

The membership flag


Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:09:38 2007 http://epydoc.sf.net