# wx.lib.combotreebox.BaseComboTreeBox¶

BaseComboTreeBox is the base class for platform specific versions of the ComboTreeBox.

## Class Hierarchy¶

Inheritance diagram for class BaseComboTreeBox:

## Methods Summary¶

 __init__ Initialize self. See help(type(self)) for accurate signature. Append Adds the itemText to the control, associating the given clientData Clear Removes all items from the control. Delete Deletes the item from the control. FindClientData Finds the first item in the tree with client data equal to the FindString Finds the first item in the tree with a label equal to the GetClientData Returns the client data associated with the given item, if any. GetCount Returns the number of items in the control. GetSelection Returns the TreeItemId of the selected item or an invalid item GetString Returns the label of the given item. GetStringSelection Returns the label of the selected item or an empty string if no item GetTree Returns the tree control that is popped up. GetValue Returns the current value in the combobox text field. Hide Hide the popped up frame with the tree. Insert Insert an item into the control before the previous item IsEmpty Returns True if the control is empty or False if it has some items. NotifyItemSelected Simulate selection of an item by the user. This is meant to NotifyNoItemSelected This is called by the PopupFrame when the user closes the OnKeyDown OnMouseClick OnText Popup Pops up the frame with the tree. SetClientData Associate the given client data with the provided item. SetClientDataSelection Selects the item with the provided clientData in the control. SetSelection Sets the provided item to be the selected item. SetString Sets the label for the provided item. SetStringSelection Selects the item with the provided string in the control. SetValue Sets the text for the combobox text field.

## Class API¶

class BaseComboTreeBox(object)

BaseComboTreeBox is the base class for platform specific versions of the ComboTreeBox.

### Methods¶

__init__(self, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Append(self, itemText, parent=None, clientData=None)

Adds the itemText to the control, associating the given clientData with the item if not None. If parent is None, itemText is added as a root item, else itemText is added as a child item of parent. The return value is the TreeItemId of the newly added item.

Parameters
• itemText (string) – text to add to the control

• parent (TreeItemId) – if None item is added as a root, else it is added as a child of the parent.

• clientData (PyObject) – the client data to find

Returns

TreeItemId of newly added item

Return type

TreeItemId

Clear(self)

Removes all items from the control.

Delete(self, item)

Deletes the item from the control.

FindClientData(self, clientData, parent=None)

Finds the first item in the tree with client data equal to the given clientData. If no such item exists, an invalid item is returned.

Parameters
• clientData (PyObject) – the client data to find

• parent (TreeItemId) – TreeItemId parent or None

Returns

TreeItemId

Return type

TreeItemId

FindString(self, string, parent=None)

Finds the first item in the tree with a label equal to the given string. If no such item exists, an invalid item is returned.

Parameters
• string (string) – string to be found in label

• parent (TreeItemId) – TreeItemId parent or None

Returns

TreeItemId

Return type

TreeItemId

GetClientData(self, item)

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

Parameters

item (TreeItemId) – item for which to get clientData

Returns

the client data

Return type

PyObject

GetCount(self)

Returns the number of items in the control.

Returns

items in control

Return type

integer

GetSelection(self)

Returns the TreeItemId of the selected item or an invalid item if no item is selected.

Returns

a TreeItemId

Return type

TreeItemId

GetString(self, item)

Returns the label of the given item.

Parameters

item (TreeItemId) – TreeItemId for which to get the label

Returns

label

Return type

string

GetStringSelection(self)

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

Returns

the label of the selected item or an empty string

Return type

string

GetTree(self)

Returns the tree control that is popped up.

GetValue(self)

Returns the current value in the combobox text field.

Returns

the current value in the combobox text field

Return type

string

Hide(self)

Hide the popped up frame with the tree.

Insert(self, itemText, previous=None, parent=None, clientData=None)

Insert an item into the control before the previous item and/or as child of the parent item. The itemText is associated with clientData when not None.

Parameters
• itemText (string) – the items label

• previous (TreeItemId) – the previous item

• parent (TreeItemId) – the parent item

• clientData (PyObject) – the data to associate

Returns

the create TreeItemId

Return type

TreeItemId

IsEmpty(self)

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

Returns

True if control is empty

Return type

boolean

NotifyItemSelected(self, text)

Simulate selection of an item by the user. This is meant to be called by the PopupFrame when the user selects an item.

NotifyNoItemSelected(self)

This is called by the PopupFrame when the user closes the PopupFrame, without selecting an item.

OnKeyDown(self, keyEvent)

OnMouseClick(self, event)

OnText(self, event)

Popup(self)

Pops up the frame with the tree.

SetClientData(self, item, clientData)

Associate the given client data with the provided item.

Parameters
• item (TreeItemId) – item for which to set the clientData

• clientData (PyObject) – the data to set

SetClientDataSelection(self, clientData)

Selects the item with the provided clientData in the control. Returns True if the item belonging to the clientData has been selected, False if it wasn’t found in the control.

Parameters

clientData (PyObject) – the client data to find

Returns

True if an item has been selected, otherwise False :rtype: bool

SetSelection(self, item)

Sets the provided item to be the selected item.

Parameters

item (TreeItemId) – Select this item

SetString(self, item, string)

Sets the label for the provided item.

Parameters
• item (TreeItemId) – item on which to set the label

• string (string) – the label to set

SetStringSelection(self, string)

Selects the item with the provided string in the control. Returns True if the provided string has been selected, False if it wasn’t found in the control.

Parameters

string (string) – try to select the item with this string

Returns

True if an item has been selected

Return type

boolean

SetValue(self, value)

Sets the text for the combobox text field.

NB: For a combobox with wxCB_READONLY style the string must be in the combobox choices list, otherwise the call to SetValue() is ignored.

Parameters

value (string) – set the combobox text field