wxRuby Documentation Home

# Wx::TreeEvent

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

## Derived from

NotifyEvent

CommandEvent

Event

Object

## Event table macros

To process input from a tree control, use these methods to set up event
handler blocks that take a TreeEvent argument.

evt_tree_begin_drag(id) { | event | … } | The user has started dragging an item with the left mouse button. The event handler must call TreeEvent::Allow() for the drag operation to continue.
evt_tree_begin_rdrag(id) { | event | … } | The user has started dragging an item with the right mouse button. The event handler must call TreeEvent::Allow() for the drag operation to continue.
evt_tree_begin_label_edit(id) { | event | … } | Begin editing a label. This can be prevented by calling Veto.
evt_tree_end_drag(id) { | event | … } | The user has released the mouse after dragging an item.
evt_tree_end_label_edit(id) { | event | … } | The user has finished editing a label. This can be prevented by calling Veto.
evt_tree_delete_item(id) { | event | … } | A tree item has been deleted.
evt_tree_item_activated(id) { | event | … } | An item has been activated (e.g. double clicked).
evt_tree_item_collapsed(id) { | event | … } | The item has been collapsed.
evt_tree_item_collapsing(id) { | event | … } | The item is being collapsed. This can be prevented by calling Veto.
evt_tree_item_expanded(id) { | event | … } | The item has been expanded.
evt_tree_item_expanding(id) { | event | … } | The item is being expanded. This can be prevented by calling Veto.
evt_tree_item_right_click(id) { | event | … } | The user has clicked the item with the right mouse button.
evt_tree_item_middle_click(id) { | event | … } | The user has clicked the item with the middle mouse button.
evt_tree_key_down(id) { | event | … } | A key has been pressed.
evt_tree_sel_changed(id) { | event | … } | Selection has changed.
evt_tree_sel_changing(id) { | event | … } | Selection is changing. This can be prevented by calling Veto.
evt_tree_key_down(id) { | event | … } | A key has been pressed.
evt_tree_item_gettooltip(id) { | event | … } | The opportunity to set the item tooltipis being given to the application (call TreeEvent::SetToolTip). Windows only.
evt_tree_item_menu(id) { | event | … } | 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(id) { | event | … } | The state image has been clicked. Windows only.

## See also

TreeCtrl

## Methods

- TreeEvent.new
- TreeEvent#get_key_code
- TreeEvent#get_item
- TreeEvent#get_key_event
- TreeEvent#get_label
- TreeEvent#get_old_item
- TreeEvent#set_tool_tip

### TreeEvent.new

TreeEvent.new(%(arg-type)TYPE% commandType = 0, Integer id = 0)

Constructor.

### TreeEvent#get_key_code

Integer get_key_code()

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

### TreeEvent#get_item

TreeItemId get_item()

Returns the item (valid for all events). See TreeCtrl
for information about TreeItemIds.

### TreeEvent#get_key_event

KeyEvent get_key_event()

Returns the key event for `EVT_TREE_KEY_DOWN` events.

### TreeEvent#get_label

String get_label()

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

### TreeEvent#get_old_item

TreeItemId get_old_item()

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

### TreeEvent#get_point

Point get_point()

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

### TreeEvent#is_edit_cancelled

Boolean is_edit_cancelled()

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

### TreeEvent#set_tool_tip

set_tool_tip(%(arg-type)String% tooltip)

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

[This page automatically generated from the Textile source at 2023-06-09 00:45:36 +0000]