.. include:: headings.inc .. currentmodule:: dataview .. _dataview.DataViewEvent: ========================================================================================================================================== |phoenix_title| **DataViewEvent** ========================================================================================================================================== This is the event class for the :ref:`dataview.DataViewCtrl` notifications. .. _DataViewEvent-events: |events| Events Emitted by this Class ===================================== Handlers bound for the following event types will receive a :ref:`dataview.DataViewEvent` parameter. - EVT_DATAVIEW_SELECTION_CHANGED: Process a ``wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED`` event. - EVT_DATAVIEW_ITEM_ACTIVATED: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED`` event. - EVT_DATAVIEW_ITEM_EDITING_STARTED: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED`` event. - EVT_DATAVIEW_ITEM_EDITING_DONE: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE`` event. - EVT_DATAVIEW_ITEM_COLLAPSING: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING`` event. - EVT_DATAVIEW_ITEM_COLLAPSED: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED`` event. - EVT_DATAVIEW_ITEM_EXPANDING: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING`` event. - EVT_DATAVIEW_ITEM_EXPANDED: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED`` event. - EVT_DATAVIEW_ITEM_VALUE_CHANGED: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED`` event. - EVT_DATAVIEW_ITEM_CONTEXT_MENU: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU`` event. - EVT_DATAVIEW_COLUMN_HEADER_CLICK: Process a ``wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK`` event. - EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK: Process a ``wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED`` event. - EVT_DATAVIEW_COLUMN_SORTED: Process a ``wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED`` event. - EVT_DATAVIEW_COLUMN_REORDERED: Process a ``wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED`` event. Currently this even is only generated when using the native OSX version. - EVT_DATAVIEW_ITEM_BEGIN_DRAG: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG`` event. - EVT_DATAVIEW_ITEM_DROP_POSSIBLE: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE`` event. - EVT_DATAVIEW_ITEM_DROP: Process a ``wxEVT_COMMAND_DATAVIEW_ITEM_DROP`` event. - EVT_DATAVIEW_CACHE_HINT: Process a ``wxEVT_COMMAND_DATAVIEW_CACHE_HINT`` event. | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **DataViewEvent** .. raw:: html

Inheritance diagram of DataViewEvent

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~DataViewEvent.__init__` Constructor. :meth:`~DataViewEvent.GetCacheFrom` Return the first row that will be displayed. :meth:`~DataViewEvent.GetCacheTo` Return the last row that will be displayed. :meth:`~DataViewEvent.GetColumn` Returns the position of the column in the control or -1 if no column field was set by the event emitter. :meth:`~DataViewEvent.GetDataBuffer` Gets the data buffer for a drop data transfer. :meth:`~DataViewEvent.GetDataFormat` Gets the :ref:`DataFormat` during a drop operation. :meth:`~DataViewEvent.GetDataSize` Gets the data size for a drop data transfer. :meth:`~DataViewEvent.GetDataViewColumn` Returns a pointer to the :ref:`dataview.DataViewColumn` from which the event was emitted or ``None``. :meth:`~DataViewEvent.GetDropEffect` Returns the effect the user requested to happen to the dropped data. :meth:`~DataViewEvent.GetModel` Returns the :ref:`dataview.DataViewModel` associated with the event. :meth:`~DataViewEvent.GetPosition` Returns the position of a context menu event in screen coordinates. :meth:`~DataViewEvent.GetValue` Returns a reference to a value. :meth:`~DataViewEvent.IsEditCancelled` Can be used to determine whether the new value is going to be accepted in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler. :meth:`~DataViewEvent.SetColumn` Sets the column index associated with this event. :meth:`~DataViewEvent.SetDataObject` Set :ref:`DataObject` for data transfer within a drag operation. :meth:`~DataViewEvent.SetDataViewColumn` For ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK`` only. :meth:`~DataViewEvent.SetDragFlags` Specify the kind of the drag operation to perform. :meth:`~DataViewEvent.SetModel` Sets the dataview model associated with this event. :meth:`~DataViewEvent.SetValue` Sets the value associated with this event. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~DataViewEvent.CacheFrom` See :meth:`~DataViewEvent.GetCacheFrom` :attr:`~DataViewEvent.CacheTo` See :meth:`~DataViewEvent.GetCacheTo` :attr:`~DataViewEvent.Column` See :meth:`~DataViewEvent.GetColumn` and :meth:`~DataViewEvent.SetColumn` :attr:`~DataViewEvent.DataBuffer` See :meth:`~DataViewEvent.GetDataBuffer` :attr:`~DataViewEvent.DataFormat` See :meth:`~DataViewEvent.GetDataFormat` :attr:`~DataViewEvent.DataSize` See :meth:`~DataViewEvent.GetDataSize` :attr:`~DataViewEvent.DataViewColumn` See :meth:`~DataViewEvent.GetDataViewColumn` and :meth:`~DataViewEvent.SetDataViewColumn` :attr:`~DataViewEvent.DropEffect` See :meth:`~DataViewEvent.GetDropEffect` :attr:`~DataViewEvent.Model` See :meth:`~DataViewEvent.GetModel` and :meth:`~DataViewEvent.SetModel` :attr:`~DataViewEvent.Position` See :meth:`~DataViewEvent.GetPosition` :attr:`~DataViewEvent.Value` See :meth:`~DataViewEvent.GetValue` and :meth:`~DataViewEvent.SetValue` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: DataViewEvent(NotifyEvent) This is the event class for the DataViewCtrl notifications. **Possible constructors**:: DataViewEvent(commandType=wxEVT_NULL, winid=0) .. method:: __init__(self, commandType=wxEVT_NULL, winid=0) Constructor. Typically used by wxWidgets internals only. :param `commandType`: :type `commandType`: EventType :param `winid`: :type `winid`: int .. method:: GetCacheFrom(self) Return the first row that will be displayed. :rtype: `int` .. method:: GetCacheTo(self) Return the last row that will be displayed. :rtype: `int` .. method:: GetColumn(self) Returns the position of the column in the control or -1 if no column field was set by the event emitter. :rtype: `int` .. method:: GetDataBuffer(self) Gets the data buffer for a drop data transfer. .. method:: GetDataFormat(self) Gets the :ref:`DataFormat` during a drop operation. :rtype: :ref:`DataFormat` .. method:: GetDataSize(self) Gets the data size for a drop data transfer. :rtype: `int` .. method:: GetDataViewColumn(self) Returns a pointer to the :ref:`dataview.DataViewColumn` from which the event was emitted or ``None``. :rtype: :ref:`dataview.DataViewColumn` .. method:: GetDropEffect(self) Returns the effect the user requested to happen to the dropped data. This function can be used inside wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE and wxEVT_COMMAND_DATAVIEW_ITEM_DROP handlers and returns whether the user is trying to copy (the return value is :meth:`DragCopy` ) or move (if the return value is :meth:`DragMove` ) the data. Currently this is only available when using the generic version of :ref:`dataview.DataViewCtrl` (used e.g. under MSW) and always returns :meth:`DragNone` in the GTK and OS X native versions. :rtype: :ref:`DragResult` .. versionadded:: 2.9.4 .. method:: GetModel(self) Returns the :ref:`dataview.DataViewModel` associated with the event. :rtype: :ref:`dataview.DataViewModel` .. method:: GetPosition(self) Returns the position of a context menu event in screen coordinates. :rtype: :ref:`Point` .. method:: GetValue(self) Returns a reference to a value. :rtype: `Variant` .. method:: IsEditCancelled(self) Can be used to determine whether the new value is going to be accepted in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler. Returns ``True`` if editing the item was cancelled or if the user tried to enter an invalid value (refused by :meth:`DataViewRenderer.Validate` ). If this method returns ``False``, it means that the value in the model is about to be changed to the new one. Notice that wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event handler can call :meth:`NotifyEvent.Veto` to prevent this from happening. Currently support for setting this field and for vetoing the change is only available in the generic version of :ref:`dataview.DataViewCtrl`, i.e. under MSW but not GTK nor OS X. :rtype: `bool` .. versionadded:: 2.9.3 .. method:: SetColumn(self, col) Sets the column index associated with this event. :param `col`: :type `col`: int .. method:: SetDataObject(self, obj) Set :ref:`DataObject` for data transfer within a drag operation. :param `obj`: :type `obj`: DataObject .. method:: SetDataViewColumn(self, col) For ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK`` only. :param `col`: :type `col`: dataview.DataViewColumn .. method:: SetDragFlags(self, flags) Specify the kind of the drag operation to perform. This method can be used inside a wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG handler in order to configure the drag operation. Valid values are :meth:`Drag_CopyOnly` (default), :meth:`Drag_AllowMove` (allow the data to be moved) and :meth:`Drag_DefaultMove` . Currently it is only honoured by the generic version of :ref:`dataview.DataViewCtrl` (used e.g. under MSW) and not supported by the native GTK and OS X versions. :param `flags`: :type `flags`: int .. versionadded:: 2.9.4 .. seealso:: :meth:`GetDropEffect` .. method:: SetModel(self, model) Sets the dataview model associated with this event. :param `model`: :type `model`: dataview.DataViewModel .. method:: SetValue(self, value) Sets the value associated with this event. :param `value`: :type `value`: Variant .. attribute:: CacheFrom See :meth:`~DataViewEvent.GetCacheFrom` .. attribute:: CacheTo See :meth:`~DataViewEvent.GetCacheTo` .. attribute:: Column See :meth:`~DataViewEvent.GetColumn` and :meth:`~DataViewEvent.SetColumn` .. attribute:: DataBuffer See :meth:`~DataViewEvent.GetDataBuffer` .. attribute:: DataFormat See :meth:`~DataViewEvent.GetDataFormat` .. attribute:: DataSize See :meth:`~DataViewEvent.GetDataSize` .. attribute:: DataViewColumn See :meth:`~DataViewEvent.GetDataViewColumn` and :meth:`~DataViewEvent.SetDataViewColumn` .. attribute:: DropEffect See :meth:`~DataViewEvent.GetDropEffect` .. attribute:: Model See :meth:`~DataViewEvent.GetModel` and :meth:`~DataViewEvent.SetModel` .. attribute:: Position See :meth:`~DataViewEvent.GetPosition` .. attribute:: Value See :meth:`~DataViewEvent.GetValue` and :meth:`~DataViewEvent.SetValue`