1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.TreeEvent:
==========================================================================================================================================
|phoenix_title| **wx.TreeEvent**
==========================================================================================================================================
A tree event holds information about events associated with :ref:`wx.TreeCtrl` objects.
To process input from a tree control, use these event handler macros to direct input to member functions that take a :ref:`wx.TreeEvent` argument.
.. _TreeEvent-events:
|events| Events Emitted by this Class
=====================================
Handlers bound for the following event types will receive a :ref:`wx.TreeEvent` parameter.
Event macros:
- 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 :meth:`wx.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 :meth:`wx.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 :meth:`~wx.TreeEvent.Veto`.
- EVT_TREE_END_LABEL_EDIT: Finish editing a label. This can be prevented by calling :meth:`~wx.TreeEvent.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 double 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 :meth:`~wx.TreeEvent.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 :meth:`~wx.TreeEvent.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 :meth:`~wx.TreeEvent.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 :meth:`~wx.TreeEvent.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.
.. seealso:: :ref:`wx.TreeCtrl`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>TreeEvent</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.TreeEvent_inheritance.png" alt="Inheritance diagram of TreeEvent" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.TreeEvent.html" title="wx.TreeEvent" alt="" coords="25,315,129,344"/> <area shape="rect" id="node2" href="wx.NotifyEvent.html" title="wx.NotifyEvent" alt="" coords="20,237,135,267"/> <area shape="rect" id="node3" href="wx.Event.html" title="wx.Event" alt="" coords="38,83,116,112"/> <area shape="rect" id="node5" href="wx.CommandEvent.html" title="wx.CommandEvent" alt="" coords="5,160,149,189"/> <area shape="rect" id="node4" href="wx.Object.html" title="wx.Object" alt="" coords="36,5,117,35"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.TreeEvent.__init__` Constructor, used by wxWidgets itself only.
:meth:`~wx.TreeEvent.GetItem` Returns the item (valid for all events).
:meth:`~wx.TreeEvent.GetKeyCode` Returns the key code if the event is a key event.
:meth:`~wx.TreeEvent.GetKeyEvent` Returns the key event for ``EVT_TREE_KEY_DOWN`` events.
:meth:`~wx.TreeEvent.GetLabel` Returns the label if the event is a begin or end edit label event.
:meth:`~wx.TreeEvent.GetOldItem` Returns the old item index (valid for ``EVT_TREE_ITEM_CHANGING`` and ``EVT_TREE_ITEM_CHANGED`` events).
:meth:`~wx.TreeEvent.GetPoint` Returns the position of the mouse pointer if the event is a drag or menu-context event.
:meth:`~wx.TreeEvent.IsEditCancelled` Returns ``True`` if the label edit was cancelled.
:meth:`~wx.TreeEvent.SetToolTip` Set the tooltip for the item (valid for ``EVT_TREE_ITEM_GETTOOLTIP`` events).
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.TreeEvent.Item` See :meth:`~wx.TreeEvent.GetItem`
:attr:`~wx.TreeEvent.KeyCode` See :meth:`~wx.TreeEvent.GetKeyCode`
:attr:`~wx.TreeEvent.KeyEvent` See :meth:`~wx.TreeEvent.GetKeyEvent`
:attr:`~wx.TreeEvent.Label` See :meth:`~wx.TreeEvent.GetLabel`
:attr:`~wx.TreeEvent.OldItem` See :meth:`~wx.TreeEvent.GetOldItem`
:attr:`~wx.TreeEvent.Point` See :meth:`~wx.TreeEvent.GetPoint`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.TreeEvent(NotifyEvent)
**Possible constructors**::
TreeEvent(commandType, tree, item=TreeItemId())
A tree event holds information about events associated with TreeCtrl
objects.
.. method:: __init__(self, commandType, tree, item=TreeItemId())
Constructor, used by wxWidgets itself only.
:param `commandType`:
:type `commandType`: wx.EventType
:param `tree`:
:type `tree`: wx.TreeCtrl
:param `item`:
:type `item`: wx.TreeItemId
.. method:: GetItem(self)
Returns the item (valid for all events).
:rtype: :ref:`wx.TreeItemId`
.. method:: GetKeyCode(self)
Returns the key code if the event is a key event.
Use :meth:`GetKeyEvent` to get the values of the modifier keys for this event (i.e. Shift or Ctrl).
:rtype: `int`
.. method:: GetKeyEvent(self)
Returns the key event for ``EVT_TREE_KEY_DOWN`` events.
:rtype: :ref:`wx.KeyEvent`
.. method:: GetLabel(self)
Returns the label if the event is a begin or end edit label event.
:rtype: `string`
.. method:: GetOldItem(self)
Returns the old item index (valid for ``EVT_TREE_ITEM_CHANGING`` and ``EVT_TREE_ITEM_CHANGED`` events).
:rtype: :ref:`wx.TreeItemId`
.. method:: 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 :ref:`wx.TreeCtrl` window (so that you can pass it directly to e.g. :meth:`wx.Window.PopupMenu` ).
:rtype: :ref:`wx.Point`
.. method:: IsEditCancelled(self)
Returns ``True`` if the label edit was cancelled.
This should be called from within an ``EVT_TREE_END_LABEL_EDIT`` handler.
:rtype: `bool`
.. method:: SetToolTip(self, tooltip)
Set the tooltip for the item (valid for ``EVT_TREE_ITEM_GETTOOLTIP`` events).
Windows only.
:param `tooltip`:
:type `tooltip`: string
.. attribute:: Item
See :meth:`~wx.TreeEvent.GetItem`
.. attribute:: KeyCode
See :meth:`~wx.TreeEvent.GetKeyCode`
.. attribute:: KeyEvent
See :meth:`~wx.TreeEvent.GetKeyEvent`
.. attribute:: Label
See :meth:`~wx.TreeEvent.GetLabel`
.. attribute:: OldItem
See :meth:`~wx.TreeEvent.GetOldItem`
.. attribute:: Point
See :meth:`~wx.TreeEvent.GetPoint`
|