## wxTreeEvent

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

Derived from

wxNotifyEvent
wxCommandEvent
wxEvent
wxObject

Include files

<wx/treectrl.h>

Event table macros

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

EVT_TREE_BEGIN_DRAG(id, func) | The user has started dragging an item with the left mouse button. The event handler must call wxTreeEvent::Allow() for the drag operation to continue.
EVT_TREE_BEGIN_RDRAG(id, func) | The user has started dragging an item with the right mouse button. The event handler must call wxTreeEvent::Allow() for the drag operation to continue.
EVT_TREE_BEGIN_LABEL_EDIT(id, func) | Begin editing a label. This can be prevented by calling Veto().
EVT_TREE_END_DRAG(id, func) | The user has released the mouse after dragging an item.
EVT_TREE_END_LABEL_EDIT(id, func) | The user has finished editing a label. This can be prevented by calling Veto().
EVT_TREE_DELETE_ITEM(id, func) | A tree item has been deleted.
EVT_TREE_ITEM_ACTIVATED(id, func) | An item has been activated (e.g. double clicked).
EVT_TREE_ITEM_COLLAPSED(id, func) | The item has been collapsed.
EVT_TREE_ITEM_COLLAPSING(id, func) | The item is being collapsed. This can be prevented by calling Veto().
EVT_TREE_ITEM_EXPANDED(id, func) | The item has been expanded.
EVT_TREE_ITEM_EXPANDING(id, func) | The item is being expanded. This can be prevented by calling Veto().
EVT_TREE_ITEM_RIGHT_CLICK(id, func) | The user has clicked the item with the right mouse button.
EVT_TREE_ITEM_MIDDLE_CLICK(id, func) | The user has clicked the item with the middle mouse button.
EVT_TREE_KEY_DOWN(id, func) | A key has been pressed.
EVT_TREE_SEL_CHANGED(id, func) | Selection has changed.
EVT_TREE_SEL_CHANGING(id, func) | Selection is changing. This can be prevented by calling Veto().
EVT_TREE_KEY_DOWN(id, func) | A key has been pressed.
EVT_TREE_ITEM_GETTOOLTIP(id, func) | The opportunity to set the item tooltip is being given to the application (call wxTreeEvent::SetToolTip). Windows only.
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.

See also

wxTreeCtrl

Members

wxTreeEvent::wxTreeEvent
wxTreeEvent::GetKeyCode
wxTreeEvent::GetItem
wxTreeEvent::GetKeyEvent
wxTreeEvent::GetLabel
wxTreeEvent::GetOldItem
wxTreeEvent::GetPoint()
wxTreeEvent::IsEditCancelled()
wxTreeEvent::SetToolTip

### wxTreeEvent::wxTreeEvent

wxTreeEvent(WXTYPE commandType = 0, int id = 0)

Constructor.

### wxTreeEvent::GetKeyCode

int GetKeyCode() const

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

### wxTreeEvent::GetItem

wxTreeItemId GetItem() const

Returns the item (valid for all events).

### wxTreeEvent::GetKeyEvent

const wxKeyEvent& GetKeyEvent() const

Returns the key event for `EVT_TREE_KEY_DOWN` events.

### wxTreeEvent::GetLabel

const wxString& GetLabel() const

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

### wxTreeEvent::GetOldItem

wxTreeItemId GetOldItem() const

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

### wxTreeEvent::GetPoint()

wxPoint GetPoint() const

Returns the position of the mouse pointer if the event is a drag event.

### wxTreeEvent::IsEditCancelled()

bool IsEditCancelled() const

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

### wxTreeEvent::SetToolTip

void SetToolTip(const wxString& tooltip)

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