.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.dataview.DataViewEvent:
==========================================================================================================================================
|phoenix_title| **wx.dataview.DataViewEvent**
==========================================================================================================================================
This is the event class for the :ref:`wx.dataview.DataViewCtrl` notifications.
.. _DataViewEvent-events:
|events| Events Emitted by this Class
=====================================
Handlers bound for the following event types will receive a :ref:`wx.dataview.DataViewEvent` parameter.
- EVT_DATAVIEW_SELECTION_CHANGED: Process a ``wxEVT_DATAVIEW_SELECTION_CHANGED`` event.
- EVT_DATAVIEW_ITEM_ACTIVATED: Process a ``wxEVT_DATAVIEW_ITEM_ACTIVATED`` event.
- EVT_DATAVIEW_ITEM_EDITING_STARTED: Process a ``wxEVT_DATAVIEW_ITEM_EDITING_STARTED`` event.
- EVT_DATAVIEW_ITEM_EDITING_DONE: Process a ``wxEVT_DATAVIEW_ITEM_EDITING_DONE`` event.
- EVT_DATAVIEW_ITEM_COLLAPSING: Process a ``wxEVT_DATAVIEW_ITEM_COLLAPSING`` event.
- EVT_DATAVIEW_ITEM_COLLAPSED: Process a ``wxEVT_DATAVIEW_ITEM_COLLAPSED`` event.
- EVT_DATAVIEW_ITEM_EXPANDING: Process a ``wxEVT_DATAVIEW_ITEM_EXPANDING`` event.
- EVT_DATAVIEW_ITEM_EXPANDED: Process a ``wxEVT_DATAVIEW_ITEM_EXPANDED`` event.
- EVT_DATAVIEW_ITEM_VALUE_CHANGED: Process a ``wxEVT_DATAVIEW_ITEM_VALUE_CHANGED`` event.
- EVT_DATAVIEW_ITEM_CONTEXT_MENU: Process a ``wxEVT_DATAVIEW_ITEM_CONTEXT_MENU`` event.
- EVT_DATAVIEW_COLUMN_HEADER_CLICK: Process a ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK`` event.
- EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK: Process a ``wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK`` event.
- EVT_DATAVIEW_COLUMN_SORTED: Process a ``wxEVT_DATAVIEW_COLUMN_SORTED`` event.
- EVT_DATAVIEW_COLUMN_REORDERED: Process a ``wxEVT_DATAVIEW_COLUMN_REORDERED`` event. Currently this event is not generated when using the native GTK+ version of the control.
- EVT_DATAVIEW_ITEM_BEGIN_DRAG: Process a ``wxEVT_DATAVIEW_ITEM_BEGIN_DRAG`` event which is generated when the user starts dragging a valid item. This event must be processed and :meth:`wx.dataview.DataViewEvent.SetDataObject` must be called to actually start dragging the item.
- EVT_DATAVIEW_ITEM_DROP_POSSIBLE: Process a ``wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE`` event.
- EVT_DATAVIEW_ITEM_DROP: Process a ``wxEVT_DATAVIEW_ITEM_DROP`` event.
- EVT_DATAVIEW_CACHE_HINT: Process a ``wxEVT_DATAVIEW_CACHE_HINT`` event.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
DataViewEvent:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewEvent.__init__` Default constructor, normally shouldn't be used and mostly exists only for backwards compatibility.
:meth:`~wx.dataview.DataViewEvent.GetCacheFrom` Return the first row that will be displayed.
:meth:`~wx.dataview.DataViewEvent.GetCacheTo` Return the last row that will be displayed.
:meth:`~wx.dataview.DataViewEvent.GetColumn` Returns the position of the column in the control or -1 if column field is unavailable for this event.
:meth:`~wx.dataview.DataViewEvent.GetDataBuffer` Gets the data buffer for a drop data transfer
:meth:`~wx.dataview.DataViewEvent.GetDataFormat` Gets the :ref:`wx.DataFormat` during a drop operation.
:meth:`~wx.dataview.DataViewEvent.GetDataObject`
:meth:`~wx.dataview.DataViewEvent.GetDataSize` Gets the data size for a drop data transfer.
:meth:`~wx.dataview.DataViewEvent.GetDataViewColumn` Returns a pointer to the :ref:`wx.dataview.DataViewColumn` from which the event was emitted or ``None``.
:meth:`~wx.dataview.DataViewEvent.GetDragFlags`
:meth:`~wx.dataview.DataViewEvent.GetDropEffect` Returns the effect the user requested to happen to the dropped data.
:meth:`~wx.dataview.DataViewEvent.GetItem` Returns the item affected by the event.
:meth:`~wx.dataview.DataViewEvent.GetModel` Returns the :ref:`wx.dataview.DataViewModel` associated with the event.
:meth:`~wx.dataview.DataViewEvent.GetPosition` Returns the position of a context menu event in client coordinates.
:meth:`~wx.dataview.DataViewEvent.GetProposedDropIndex` Returns the index of the child item at which an item currently being dragged would be dropped.
:meth:`~wx.dataview.DataViewEvent.GetValue` Returns a reference to a value.
:meth:`~wx.dataview.DataViewEvent.IsEditCancelled` Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.
:meth:`~wx.dataview.DataViewEvent.SetCache`
:meth:`~wx.dataview.DataViewEvent.SetColumn` Sets the column index associated with this event.
:meth:`~wx.dataview.DataViewEvent.SetDataBuffer`
:meth:`~wx.dataview.DataViewEvent.SetDataFormat`
:meth:`~wx.dataview.DataViewEvent.SetDataObject` Set :ref:`wx.DataObject` for data transfer within a drag operation.
:meth:`~wx.dataview.DataViewEvent.SetDataSize`
:meth:`~wx.dataview.DataViewEvent.SetDataViewColumn` For ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK`` only.
:meth:`~wx.dataview.DataViewEvent.SetDragFlags` Specify the kind of the drag operation to perform.
:meth:`~wx.dataview.DataViewEvent.SetDropEffect`
:meth:`~wx.dataview.DataViewEvent.SetItem`
:meth:`~wx.dataview.DataViewEvent.SetModel` Sets the dataview model associated with this event.
:meth:`~wx.dataview.DataViewEvent.SetPosition`
:meth:`~wx.dataview.DataViewEvent.SetValue` Sets the value associated with this event.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.dataview.DataViewEvent.CacheFrom` See :meth:`~wx.dataview.DataViewEvent.GetCacheFrom`
:attr:`~wx.dataview.DataViewEvent.CacheTo` See :meth:`~wx.dataview.DataViewEvent.GetCacheTo`
:attr:`~wx.dataview.DataViewEvent.Column` See :meth:`~wx.dataview.DataViewEvent.GetColumn` and :meth:`~wx.dataview.DataViewEvent.SetColumn`
:attr:`~wx.dataview.DataViewEvent.DataBuffer` See :meth:`~wx.dataview.DataViewEvent.GetDataBuffer` and :meth:`~wx.dataview.DataViewEvent.SetDataBuffer`
:attr:`~wx.dataview.DataViewEvent.DataFormat` See :meth:`~wx.dataview.DataViewEvent.GetDataFormat` and :meth:`~wx.dataview.DataViewEvent.SetDataFormat`
:attr:`~wx.dataview.DataViewEvent.DataObject` See :meth:`~wx.dataview.DataViewEvent.GetDataObject` and :meth:`~wx.dataview.DataViewEvent.SetDataObject`
:attr:`~wx.dataview.DataViewEvent.DataSize` See :meth:`~wx.dataview.DataViewEvent.GetDataSize` and :meth:`~wx.dataview.DataViewEvent.SetDataSize`
:attr:`~wx.dataview.DataViewEvent.DataViewColumn` See :meth:`~wx.dataview.DataViewEvent.GetDataViewColumn` and :meth:`~wx.dataview.DataViewEvent.SetDataViewColumn`
:attr:`~wx.dataview.DataViewEvent.DragFlags` See :meth:`~wx.dataview.DataViewEvent.GetDragFlags` and :meth:`~wx.dataview.DataViewEvent.SetDragFlags`
:attr:`~wx.dataview.DataViewEvent.DropEffect` See :meth:`~wx.dataview.DataViewEvent.GetDropEffect` and :meth:`~wx.dataview.DataViewEvent.SetDropEffect`
:attr:`~wx.dataview.DataViewEvent.Item` See :meth:`~wx.dataview.DataViewEvent.GetItem` and :meth:`~wx.dataview.DataViewEvent.SetItem`
:attr:`~wx.dataview.DataViewEvent.Model` See :meth:`~wx.dataview.DataViewEvent.GetModel` and :meth:`~wx.dataview.DataViewEvent.SetModel`
:attr:`~wx.dataview.DataViewEvent.Position` See :meth:`~wx.dataview.DataViewEvent.GetPosition` and :meth:`~wx.dataview.DataViewEvent.SetPosition`
:attr:`~wx.dataview.DataViewEvent.ProposedDropIndex` See :meth:`~wx.dataview.DataViewEvent.GetProposedDropIndex`
:attr:`~wx.dataview.DataViewEvent.Value` See :meth:`~wx.dataview.DataViewEvent.GetValue` and :meth:`~wx.dataview.DataViewEvent.SetValue`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.dataview.DataViewEvent(NotifyEvent)
**Possible constructors**::
DataViewEvent() -> None
DataViewEvent(evtType : EventType, dvc : DataViewCtrl, column :
DataViewColumn, item: DataViewItem=DataViewItem()) -> None
DataViewEvent(evtType : EventType, dvc : DataViewCtrl, item :
DataViewItem) -> None
DataViewEvent(event : DataViewEvent) -> None
This is the event class for the DataViewCtrl notifications.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Default constructor, normally shouldn't be used and mostly exists only for backwards compatibility.
:rtype: `None`
:html:`
`
**__init__** `(self, evtType : EventType, dvc : DataViewCtrl, column : DataViewColumn, item: DataViewItem=DataViewItem())`
Constructor for the events affecting columns (and possibly also items).
:param `evtType`:
:type `evtType`: wx.EventType
:param `dvc`:
:type `dvc`: wx.dataview.DataViewCtrl
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `None`
:html:`
`
**__init__** `(self, evtType : EventType, dvc : DataViewCtrl, item : DataViewItem)`
Constructor for the events affecting only the items.
:param `evtType`:
:type `evtType`: wx.EventType
:param `dvc`:
:type `dvc`: wx.dataview.DataViewCtrl
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `None`
:html:`
`
**__init__** `(self, event : DataViewEvent)`
Copy constructor.
:param `event`:
:type `event`: wx.dataview.DataViewEvent
:rtype: `None`
:html:`
`
.. 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 column field is unavailable for this event.
For wxEVT_DATAVIEW_COLUMN_REORDERED, this is the new position of the column.
:rtype: `int`
.. method:: GetDataBuffer(self)
Gets the data buffer for a drop data transfer
:rtype: `Any`
.. method:: GetDataFormat(self)
Gets the :ref:`wx.DataFormat` during a drop operation.
:rtype: `DataFormat`
.. method:: GetDataObject(self)
:rtype: `DataObject`
.. method:: GetDataSize(self)
Gets the data size for a drop data transfer.
:rtype: `int`
.. method:: GetDataViewColumn(self)
Returns a pointer to the :ref:`wx.dataview.DataViewColumn` from which the event was emitted or ``None``.
:rtype: :ref:`wx.dataview.DataViewColumn`
.. method:: GetDragFlags(self)
:rtype: `int`
.. method:: GetDropEffect(self)
Returns the effect the user requested to happen to the dropped data.
This function can be used inside wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE and wxEVT_DATAVIEW_ITEM_DROP handlers and returns whether the user is trying to copy (the return value is `wx.DragCopy` ) or move (if the return value is `wx.DragMove` ) the data.
Currently this is only available when using the generic version of :ref:`wx.dataview.DataViewCtrl` (used e.g. under MSW) and always returns `wx.DragNone` in the GTK and macOS native versions.
:rtype: `DragResult`
.. versionadded:: 2.9.4
.. method:: GetItem(self)
Returns the item affected by the event.
Notice that for ``wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE`` and ``wxEVT_DATAVIEW_ITEM_DROP`` event handlers, the item may be invalid, indicating that the drop is about to happen outside of the item area.
:rtype: :ref:`wx.dataview.DataViewItem`
.. method:: GetModel(self)
Returns the :ref:`wx.dataview.DataViewModel` associated with the event.
:rtype: :ref:`wx.dataview.DataViewModel`
.. method:: GetPosition(self)
Returns the position of a context menu event in client coordinates.
:rtype: `Point`
.. method:: GetProposedDropIndex(self)
Returns the index of the child item at which an item currently being dragged would be dropped.
This function can be used from wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE handlers to determine the exact position of the item being dropped.
Note that it currently always returns ``wx.NOT_FOUND`` when using native GTK implementation of this control.
:rtype: `int`
.. versionadded:: 4.1/wxWidgets-3.1.2
.. method:: GetValue(self)
Returns a reference to a value.
:rtype: `DVCVariant`
.. method:: IsEditCancelled(self)
Can be used to determine whether the new value is going to be accepted in wxEVT_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:`wx.dataview.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_DATAVIEW_ITEM_EDITING_DONE event handler can call :meth:`wx.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:`wx.dataview.DataViewCtrl`, i.e. under MSW but not GTK nor macOS.
:rtype: `bool`
.. versionadded:: 2.9.3
.. method:: SetCache(self, from_ : int, to_ : int)
:param `from_`:
:type `from_`: int
:param `to_`:
:type `to_`: int
:rtype: `None`
.. method:: SetColumn(self, col : int)
Sets the column index associated with this event.
:param `col`:
:type `col`: int
:rtype: `None`
.. method:: SetDataBuffer(self, buf : Any)
:param `buf`:
:rtype: `None`
.. method:: SetDataFormat(self, format : DataFormat)
:param `format`:
:type `format`: wx.DataFormat
:rtype: `None`
.. method:: SetDataObject(self, obj : DataObject)
Set :ref:`wx.DataObject` for data transfer within a drag operation.
This method must be used inside a ``wxEVT_DATAVIEW_ITEM_BEGIN_DRAG`` handler to associate the data object to be dragged with the item.
Note that the control takes ownership of the data object, i.e. `obj` must be heap-allocated and will be deleted by :ref:`wx.dataview.DataViewCtrl` itself.
:param `obj`:
:type `obj`: wx.DataObject
:rtype: `None`
.. method:: SetDataSize(self, size : int)
:param `size`:
:type `size`: int
:rtype: `None`
.. method:: SetDataViewColumn(self, col : DataViewColumn)
For ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK`` only.
:param `col`:
:type `col`: wx.dataview.DataViewColumn
:rtype: `None`
.. method:: SetDragFlags(self, flags : int)
Specify the kind of the drag operation to perform.
This method can be used inside a ``wxEVT_DATAVIEW_ITEM_BEGIN_DRAG`` handler in order to configure the drag operation. Valid values are `wx.Drag_CopyOnly` (default), `wx.Drag_AllowMove` (allow the data to be moved) and `wx.Drag_DefaultMove` .
Currently it is only honoured by the generic version of :ref:`wx.dataview.DataViewCtrl` (used e.g. under MSW) and not supported by the native GTK and macOS versions.
:param `flags`:
:type `flags`: int
:rtype: `None`
.. versionadded:: 2.9.4
.. seealso:: :meth:`GetDropEffect`
.. method:: SetDropEffect(self, effect : DragResult)
:param `effect`:
:type `effect`: wx.DragResult
:rtype: `None`
.. method:: SetItem(self, item : DataViewItem)
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `None`
.. method:: SetModel(self, model : DataViewModel)
Sets the dataview model associated with this event.
:param `model`:
:type `model`: wx.dataview.DataViewModel
:rtype: `None`
.. method:: SetPosition(self, x : int, y : int)
:param `x`:
:type `x`: int
:param `y`:
:type `y`: int
:rtype: `None`
.. method:: SetValue(self, value : DVCVariant)
Sets the value associated with this event.
:param `value`:
:type `value`: DVCVariant
:rtype: `None`
.. attribute:: CacheFrom
See :meth:`~wx.dataview.DataViewEvent.GetCacheFrom`
.. attribute:: CacheTo
See :meth:`~wx.dataview.DataViewEvent.GetCacheTo`
.. attribute:: Column
See :meth:`~wx.dataview.DataViewEvent.GetColumn` and :meth:`~wx.dataview.DataViewEvent.SetColumn`
.. attribute:: DataBuffer
See :meth:`~wx.dataview.DataViewEvent.GetDataBuffer` and :meth:`~wx.dataview.DataViewEvent.SetDataBuffer`
.. attribute:: DataFormat
See :meth:`~wx.dataview.DataViewEvent.GetDataFormat` and :meth:`~wx.dataview.DataViewEvent.SetDataFormat`
.. attribute:: DataObject
See :meth:`~wx.dataview.DataViewEvent.GetDataObject` and :meth:`~wx.dataview.DataViewEvent.SetDataObject`
.. attribute:: DataSize
See :meth:`~wx.dataview.DataViewEvent.GetDataSize` and :meth:`~wx.dataview.DataViewEvent.SetDataSize`
.. attribute:: DataViewColumn
See :meth:`~wx.dataview.DataViewEvent.GetDataViewColumn` and :meth:`~wx.dataview.DataViewEvent.SetDataViewColumn`
.. attribute:: DragFlags
See :meth:`~wx.dataview.DataViewEvent.GetDragFlags` and :meth:`~wx.dataview.DataViewEvent.SetDragFlags`
.. attribute:: DropEffect
See :meth:`~wx.dataview.DataViewEvent.GetDropEffect` and :meth:`~wx.dataview.DataViewEvent.SetDropEffect`
.. attribute:: Item
See :meth:`~wx.dataview.DataViewEvent.GetItem` and :meth:`~wx.dataview.DataViewEvent.SetItem`
.. attribute:: Model
See :meth:`~wx.dataview.DataViewEvent.GetModel` and :meth:`~wx.dataview.DataViewEvent.SetModel`
.. attribute:: Position
See :meth:`~wx.dataview.DataViewEvent.GetPosition` and :meth:`~wx.dataview.DataViewEvent.SetPosition`
.. attribute:: ProposedDropIndex
See :meth:`~wx.dataview.DataViewEvent.GetProposedDropIndex`
.. attribute:: Value
See :meth:`~wx.dataview.DataViewEvent.GetValue` and :meth:`~wx.dataview.DataViewEvent.SetValue`