wx.TreeEvent

Inheritance diagram for wx.TreeEvent:



Description

A tree event holds information about events associated with wx.TreeCtrl objects.

See also

wx.TreeCtrl

Event Handling

Event Name Description
wx.EVT_TREE_BEGIN_DRAG(id, func) Begin dragging with the left mouse button.
wx.EVT_TREE_BEGIN_RDRAG(id, func) Begin dragging with the right mouse button.
wx.EVT_TREE_END_DRAG(id, func) End dragging with the left or right mouse button.
wx.EVT_TREE_BEGIN_LABEL_EDIT(id, func) Begin editing a label. This can be prevented by calling Veto.
wx.EVT_TREE_END_LABEL_EDIT(id, func) Finish editing a label. This can be prevented by calling Veto.
wx.EVT_TREE_DELETE_ITEM(id, func) Delete an item.
wx.EVT_TREE_GET_INFO(id, func) Request information from the application.
wx.EVT_TREE_SET_INFO(id, func) Information is being supplied.
wx.EVT_TREE_ITEM_ACTIVATED(id, func) The item has been activated, i.e. chosen by double clicking it with mouse or from keyboard
wx.EVT_TREE_ITEM_COLLAPSED(id, func) The item has been collapsed.
wx.EVT_TREE_ITEM_COLLAPSING(id, func) The item is being collapsed. This can be prevented by calling Veto.
wx.EVT_TREE_ITEM_EXPANDED(id, func) The item has been expanded.
wx.EVT_TREE_ITEM_EXPANDING(id, func) The item is being expanded. This can be prevented by calling Veto.
wx.EVT_TREE_ITEM_RIGHT_CLICK(id, func) The user has clicked the item with the right mouse button.
wx.EVT_TREE_ITEM_MIDDLE_CLICK(id, func) The user has clicked the item with the middle mouse button.
wx.EVT_TREE_SEL_CHANGED(id, func) Selection has changed.
wx.EVT_TREE_SEL_CHANGING(id, func) Selection is changing. This can be prevented by calling Veto.
wx.EVT_TREE_KEY_DOWN(id, func) A key has been pressed.
wx.EVT_TREE_ITEM_GETTOOLTIP(id, func) The opportunity to set the item tooltip is being given to the application (call SetToolTip). Windows only.
wx.EVT_TREE_ITEM_MENU(id, func) The context menu for the selected item has been requested, either by a right click or by using the menu key.
wx.EVT_TREE_STATE_IMAGE_CLICK(id, func) The state image has been clicked. Windows only.

Class API

Methods

__init__(commandType=wx.wxEVT_NULL, id=0)

Alternate constructor:

__init__(commandType, tree, item=None)

Parameters:

  • commandType (eventtype)
  • id (int)

Returns:

wx.TreeEvent


GetItem()

Returns the item (valid for all events).


Returns:

wx.TreeItemId


GetKeyCode()

Returns the key code if the event is a key event. Use GetKeyEvent to get the values of the modifier keys for this event (i.e. Shift or Ctrl).


Returns:

int


GetKeyEvent()

Returns the key event for wx.EVT_TREE_KEY_DOWN events.


Returns:

wx.KeyEvent


GetLabel()

Returns the label if the event is a begin or end edit label event.


Returns:

string


GetOldItem()

Returns the old item index (valid for wx.EVT_TREE_ITEM_CHANGING and CHANGED events)


Returns:

wx.TreeItemId


GetPoint()

Returns the position of the mouse pointer if the event is a drag or menu-context event. In both cases the position is in client coordinates - i.e. relative to the wx.TreeCtrl window (so that you can pass it directly to e.g. wx.Window.PopupMenu).


Returns:

wx.Point


GetToolTip()

Get the tooltip for the item (valid for wx.EVT_TREE_ITEM_GETTOOLTIP events). Windows only.


Returns:

string


IsEditCancelled()

Returns True if the label edit was cancelled. This should be called from within an wx.EVT_TREE_END_LABEL_EDIT handler.


Returns:

bool


SetEditCanceled(editCancelled)

Parameters:

  • editCancelled (bool)

SetItem(item)

Parameters:


SetKeyEvent(evt)

Parameters:


SetLabel(label)

Parameters:

  • label (string)

SetOldItem(item)

Parameters:


SetPoint(pt)

Parameters:


SetToolTip(tooltip)

Set the tooltip for the item (valid for wx.EVT_TREE_ITEM_GETTOOLTIP events). Windows only.

Parameters:

  • tooltip (string)

Properties

EditCancelled
See IsEditCancelled and SetEditCanceled
Item
See GetItem and SetItem
KeyCode
See GetKeyCode
KeyEvent
See GetKeyEvent and SetKeyEvent
Label
See GetLabel and SetLabel
OldItem
See GetOldItem and SetOldItem
Point
See GetPoint and SetPoint
ToolTip
See GetToolTip and SetToolTip