.. 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.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 even is only generated when using the native OSX version.   
- EVT_DATAVIEW_ITEM_BEGIN_DRAG: Process a  ``wxEVT_DATAVIEW_ITEM_BEGIN_DRAG``   event.   
- 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

   <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>DataViewEvent</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.dataview.DataViewEvent_inheritance.png" alt="Inheritance diagram of DataViewEvent" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.dataview.DataViewEvent.html" title="This is the event class for the wx.dataview.DataViewCtrl  notifications." alt="" coords="5,315,217,344"/> <area shape="rect" id="node2" href="wx.NotifyEvent.html" title="This class is not used by the event handlers by itself, but is a base class for other event classes (such as wx.BookCtrlEvent)." alt="" coords="50,237,173,267"/> <area shape="rect" id="node3" href="wx.CommandEvent.html" title="This event class contains information about command events, which originate from a variety of simple controls." alt="" coords="35,160,187,189"/> <area shape="rect" id="node4" href="wx.Event.html" title="An event is a structure holding information about an event passed to a callback or member function." alt="" coords="70,83,153,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="67,5,155,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewEvent.__init__`                                      Constructor.
: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 no column field was set by the event emitter.
: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`                                       
: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 screen coordinates.
: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.SetEditCanceled`                               
: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.EditCancelled`                                 See :meth:`~wx.dataview.DataViewEvent.IsEditCancelled` and :meth:`~wx.dataview.DataViewEvent.SetEditCanceled`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.dataview.DataViewEvent(NotifyEvent)

   **Possible constructors**::

       DataViewEvent(commandType=wxEVT_NULL, winid=0)
       
   
   This is the event class for the DataViewCtrl notifications.



   .. method:: __init__(self, commandType=wxEVT_NULL, winid=0)

      Constructor.                  

      Typically used by wxWidgets internals only.                  


      :param `commandType`: 
      :type `commandType`: wx.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 

      :rtype: `PyObject`     








   .. 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 OS X native versions. 

                

      :rtype: :ref:`wx.DragResult`







      .. versionadded:: 2.9.4 
     








   .. method:: GetItem(self)



      :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 screen coordinates.                  

      :rtype: `Point`     








   .. 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 OS X. 

                

      :rtype: `bool`







      .. versionadded:: 2.9.3 
     








   .. method:: SetCache(self, from_, to_)




      :param `from_`: 
      :type `from_`: int
      :param `to_`: 
      :type `to_`: int







   .. method:: SetColumn(self, col)

      Sets the column index associated with this event.                  


      :param `col`: 
      :type `col`: int







   .. method:: SetDataBuffer(self, buf)




      :param `buf`: 







   .. method:: SetDataFormat(self, format)




      :param `format`: 
      :type `format`: wx.DataFormat







   .. method:: SetDataObject(self, obj)

      Set :ref:`wx.DataObject`  for data transfer within a drag operation.                  


      :param `obj`: 
      :type `obj`: wx.DataObject







   .. method:: SetDataSize(self, size)




      :param `size`: 
      :type `size`: int







   .. method:: SetDataViewColumn(self, col)

      For  ``wxEVT_DATAVIEW_COLUMN_HEADER_CLICK``   only.                   


      :param `col`: 
      :type `col`: wx.dataview.DataViewColumn







   .. method:: SetDragFlags(self, flags)

      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 OS X versions. 

                


      :param `flags`: 
      :type `flags`: int






      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`GetDropEffect`   








   .. method:: SetDropEffect(self, effect)




      :param `effect`: 
      :type `effect`: wx.DragResult







   .. method:: SetEditCanceled(self, editCancelled)




      :param `editCancelled`: 
      :type `editCancelled`: bool







   .. method:: SetItem(self, item)




      :param `item`: 
      :type `item`: wx.dataview.DataViewItem







   .. method:: SetModel(self, model)

      Sets the dataview model associated with this event.                  


      :param `model`: 
      :type `model`: wx.dataview.DataViewModel







   .. method:: SetPosition(self, x, y)




      :param `x`: 
      :type `x`: int
      :param `y`: 
      :type `y`: int







   .. method:: SetValue(self, value)

      Sets the value associated with this event.                  


      :param `value`: 
      :type `value`: DVCVariant







   .. attribute:: EditCancelled

      See :meth:`~wx.dataview.DataViewEvent.IsEditCancelled` and :meth:`~wx.dataview.DataViewEvent.SetEditCanceled`