Table Of Contents

Previous topic

TreeCtrl

Next topic

TreeItemIcon

This Page

phoenix_title TreeEvent

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

To process input from a tree control, use these event handler macros to direct input to member functions that take a TreeEvent argument.

events Events Emitted by this Class

Handlers bound for the following event types will receive a TreeEvent parameter.

  • EVT_TREE_BEGIN_DRAG: Begin dragging with the left mouse button. If you want to enable left-dragging you need to intercept this event and explicitly call TreeEvent.Allow , as it’s vetoed by default. Also notice that the control must have an associated image list (see SetImageList()) to drag its items under MSW.
  • EVT_TREE_BEGIN_RDRAG: Begin dragging with the right mouse button. If you want to enable right-dragging you need to intercept this event and explicitly call TreeEvent.Allow , as it’s vetoed by default.
  • EVT_TREE_END_DRAG: End dragging with the left or right mouse button.
  • EVT_TREE_BEGIN_LABEL_EDIT: Begin editing a label. This can be prevented by calling Veto.
  • EVT_TREE_END_LABEL_EDIT: Finish editing a label. This can be prevented by calling Veto.
  • EVT_TREE_DELETE_ITEM: Delete an item.
  • EVT_TREE_GET_INFO: Request information from the application.
  • EVT_TREE_SET_INFO: Information is being supplied.
  • EVT_TREE_ITEM_ACTIVATED: The item has been activated, i.e. chosen by float clicking it with mouse or from keyboard.
  • EVT_TREE_ITEM_COLLAPSED: The item has been collapsed.
  • EVT_TREE_ITEM_COLLAPSING: The item is being collapsed. This can be prevented by calling Veto.
  • EVT_TREE_ITEM_EXPANDED: The item has been expanded.
  • EVT_TREE_ITEM_EXPANDING: The item is being expanded. This can be prevented by calling Veto.
  • EVT_TREE_ITEM_RIGHT_CLICK: The user has clicked the item with the right mouse button.
  • EVT_TREE_ITEM_MIDDLE_CLICK: The user has clicked the item with the middle mouse button.
  • EVT_TREE_SEL_CHANGED: Selection has changed.
  • EVT_TREE_SEL_CHANGING: Selection is changing. This can be prevented by calling Veto.
  • EVT_TREE_KEY_DOWN: A key has been pressed.
  • EVT_TREE_ITEM_GETTOOLTIP: The opportunity to set the item tooltip is being given to the application (call SetToolTip). Windows only.
  • EVT_TREE_ITEM_MENU: The context menu for the selected item has been requested, either by a right click or by using the menu key.
  • EVT_TREE_STATE_IMAGE_CLICK: The state image has been clicked.

See also

TreeCtrl


class_hierarchy Inheritance Diagram

Inheritance diagram for class TreeEvent

Inheritance diagram of TreeEvent


method_summary Methods Summary

__init__ Constructor, used by wxWidgets itself only.
GetItem Returns the item (valid for all events).
GetKeyCode Returns the key code if the event is a key event.
GetKeyEvent Returns the key event for EVT_TREE_KEY_DOWN events.
GetLabel Returns the label if the event is a begin or end edit label event.
GetOldItem Returns the old item index (valid for EVT_TREE_ITEM_CHANGING and EVT_TREE_ITEM_CHANGED events).
GetPoint Returns the position of the mouse pointer if the event is a drag or menu-context event.
IsEditCancelled Returns True if the label edit was cancelled.
SetToolTip Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP events).

api Class API



class TreeEvent(NotifyEvent)

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

Possible constructors:

TreeEvent(commandType, tree, item=TreeItemId())

Methods



__init__(self, commandType, tree, item=TreeItemId())

Constructor, used by wxWidgets itself only.

Parameters:


GetItem(self)

Returns the item (valid for all events).

Return type: TreeItemId


GetKeyCode(self)

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

Return type:int


GetKeyEvent(self)

Returns the key event for EVT_TREE_KEY_DOWN events.

Return type: KeyEvent


GetLabel(self)

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

Return type:string


GetOldItem(self)

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

Return type: TreeItemId


GetPoint(self)

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 TreeCtrl window (so that you can pass it directly to e.g. Window.PopupMenu ).

Return type: Point


IsEditCancelled(self)

Returns True if the label edit was cancelled.

This should be called from within an EVT_TREE_END_LABEL_EDIT handler.

Return type:bool


SetToolTip(self, tooltip)

Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP events).

Windows only.

Parameters:tooltip (string) –

Properties



Item

See GetItem



KeyCode

See GetKeyCode



KeyEvent

See GetKeyEvent



Label

See GetLabel



OldItem

See GetOldItem



Point

See GetPoint