.. 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.ListEvent:

==========================================================================================================================================
|phoenix_title|  **wx.ListEvent**
==========================================================================================================================================

A list event holds information about events associated with :ref:`wx.ListCtrl`  objects.          







.. _ListEvent-events:

|events| Events Emitted by this Class
=====================================

Handlers bound for the following event types will receive a :ref:`wx.ListEvent` parameter.

Event macros: 

- EVT_LIST_BEGIN_DRAG: Begin dragging with the left mouse button.  
- EVT_LIST_BEGIN_RDRAG: Begin dragging with the right mouse button.  
- EVT_LIST_BEGIN_LABEL_EDIT: Begin editing a label. This can be prevented by calling :meth:`~wx.ListEvent.Veto`.  
- EVT_LIST_END_LABEL_EDIT: Finish editing a label. This can be prevented by calling :meth:`~wx.ListEvent.Veto`.  
- EVT_LIST_DELETE_ITEM: Delete an item.  
- EVT_LIST_DELETE_ALL_ITEMS: Delete all items.  
- EVT_LIST_ITEM_SELECTED: The item has been selected. Notice that the mouse is captured by the control itself when this event is generated, see :ref:`event handling overview <event handling overview>`.  
- EVT_LIST_ITEM_DESELECTED: The item has been deselected. :meth:`~wx.ListEvent.GetIndex`  may be -1 with virtual lists.  
- EVT_LIST_ITEM_ACTIVATED: The item has been activated (``ENTER`` or double click).  
- EVT_LIST_ITEM_FOCUSED: The currently focused item has changed.  
- EVT_LIST_ITEM_MIDDLE_CLICK: The middle mouse button has been clicked on an item.  
- EVT_LIST_ITEM_RIGHT_CLICK: The right mouse button has been clicked on an item.  
- EVT_LIST_KEY_DOWN: A key has been pressed. :meth:`~wx.ListEvent.GetIndex`  may be -1 if no item is selected.  
- EVT_LIST_INSERT_ITEM: An item has been inserted.  
- EVT_LIST_COL_CLICK: A column (m_col) has been left-clicked.  
- EVT_LIST_COL_RIGHT_CLICK: A column (m_col) (which can be -1 if the click occurred outside any column) has been right-clicked.  
- EVT_LIST_COL_BEGIN_DRAG: The user started resizing a column - can be vetoed.  
- EVT_LIST_COL_DRAGGING: The divider between columns is being dragged.  
- EVT_LIST_COL_END_DRAG: A column has been resized by the user.  
- EVT_LIST_CACHE_HINT: Prepare cache for a virtual list control  
- EVT_LIST_ITEM_CHECKED: The item has been checked (new since wxWidgets 3.1.0).  
- EVT_LIST_ITEM_UNCHECKED: The item has been unchecked (new since wxWidgets 3.1.0).  








         



.. seealso:: :ref:`wx.ListCtrl`    







|

|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>ListEvent</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.ListEvent_inheritance.png" alt="Inheritance diagram of ListEvent" 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.ListEvent.html" title="wx.ListEvent" alt="" coords="27,315,133,344"/> <area shape="rect" id="node2" href="wx.NotifyEvent.html" title="wx.NotifyEvent" alt="" coords="19,237,141,267"/> <area shape="rect" id="node3" href="wx.CommandEvent.html" title="wx.CommandEvent" alt="" coords="5,160,155,189"/> <area shape="rect" id="node4" href="wx.Event.html" title="wx.Event" alt="" coords="39,83,121,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="37,5,123,35"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.ListEvent.__init__`                                                   Constructor.
:meth:`~wx.ListEvent.GetCacheFrom`                                               For  ``EVT_LIST_CACHE_HINT``   event only: return the first item which the list control advises us to cache.
:meth:`~wx.ListEvent.GetCacheTo`                                                 For  ``EVT_LIST_CACHE_HINT``   event only: return the last item (inclusive) which the list control advises us to cache.
:meth:`~wx.ListEvent.GetColumn`                                                  The column position: it is only used with  ``COL``   events.
:meth:`~wx.ListEvent.GetData`                                                    The data.
:meth:`~wx.ListEvent.GetImage`                                                   The image.
:meth:`~wx.ListEvent.GetIndex`                                                   The item index.
:meth:`~wx.ListEvent.GetItem`                                                    An item object, used by some events.
:meth:`~wx.ListEvent.GetKeyCode`                                                 Key code if the event is a keypress event.
:meth:`~wx.ListEvent.GetLabel`                                                   The (new) item label for  ``EVT_LIST_END_LABEL_EDIT``   event.
:meth:`~wx.ListEvent.GetMask`                                                    The mask.
:meth:`~wx.ListEvent.GetPoint`                                                   The position of the mouse pointer if the event is a drag event.
:meth:`~wx.ListEvent.GetText`                                                    The text.
:meth:`~wx.ListEvent.IsEditCancelled`                                            This method only makes sense for  ``EVT_LIST_END_LABEL_EDIT``   message and returns ``True`` if it the label editing has been cancelled by the user (:meth:`~ListEvent.GetLabel`   returns an empty string in this case but it doesn't allow the application to distinguish between really cancelling the edit and the admittedly rare case when the user wants to rename it to an empty string).
:meth:`~wx.ListEvent.SetCacheFrom`                                               
:meth:`~wx.ListEvent.SetCacheTo`                                                 
:meth:`~wx.ListEvent.SetColumn`                                                  
:meth:`~wx.ListEvent.SetIndex`                                                   
:meth:`~wx.ListEvent.SetItem`                                                    
:meth:`~wx.ListEvent.SetKeyCode`                                                 
:meth:`~wx.ListEvent.SetPoint`                                                   
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.ListEvent.CacheFrom`                                                  See :meth:`~wx.ListEvent.GetCacheFrom` and :meth:`~wx.ListEvent.SetCacheFrom`
:attr:`~wx.ListEvent.CacheTo`                                                    See :meth:`~wx.ListEvent.GetCacheTo` and :meth:`~wx.ListEvent.SetCacheTo`
:attr:`~wx.ListEvent.Column`                                                     See :meth:`~wx.ListEvent.GetColumn` and :meth:`~wx.ListEvent.SetColumn`
:attr:`~wx.ListEvent.Data`                                                       See :meth:`~wx.ListEvent.GetData`
:attr:`~wx.ListEvent.Image`                                                      See :meth:`~wx.ListEvent.GetImage`
:attr:`~wx.ListEvent.Index`                                                      See :meth:`~wx.ListEvent.GetIndex` and :meth:`~wx.ListEvent.SetIndex`
:attr:`~wx.ListEvent.Item`                                                       See :meth:`~wx.ListEvent.GetItem` and :meth:`~wx.ListEvent.SetItem`
:attr:`~wx.ListEvent.KeyCode`                                                    See :meth:`~wx.ListEvent.GetKeyCode` and :meth:`~wx.ListEvent.SetKeyCode`
:attr:`~wx.ListEvent.Label`                                                      See :meth:`~wx.ListEvent.GetLabel`
:attr:`~wx.ListEvent.Mask`                                                       See :meth:`~wx.ListEvent.GetMask`
:attr:`~wx.ListEvent.Point`                                                      See :meth:`~wx.ListEvent.GetPoint` and :meth:`~wx.ListEvent.SetPoint`
:attr:`~wx.ListEvent.Text`                                                       See :meth:`~wx.ListEvent.GetText`
================================================================================ ================================================================================


|


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


.. class:: wx.ListEvent(NotifyEvent)

   **Possible constructors**::

       ListEvent(commandType=wxEVT_NULL, id=0)
       
   
   A list event holds information about events associated with ListCtrl
   objects.



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

      Constructor.                  


      :param `commandType`: 
      :type `commandType`: wx.EventType
      :param `id`: 
      :type `id`: int







   .. method:: GetCacheFrom(self)

      For  ``EVT_LIST_CACHE_HINT``   event only: return the first item which the list control advises us to cache.                   

      :rtype: `long`








   .. method:: GetCacheTo(self)

      For  ``EVT_LIST_CACHE_HINT``   event only: return the last item (inclusive) which the list control advises us to cache.                   

      :rtype: `long`








   .. method:: GetColumn(self)

      The column position: it is only used with  ``COL``   events.                   

      For the column dragging events, it is the column to the left of the divider being dragged, for the column click events it may be -1 if the user clicked in the list control header outside any column.                  

      :rtype: `int`








   .. method:: GetData(self)

      The data.                  

      :rtype: :ref:`wx.UIntPtr`








   .. method:: GetImage(self)

      The image.                  

      :rtype: `int`








   .. method:: GetIndex(self)

      The item index.                  

      :rtype: `long`








   .. method:: GetItem(self)

      An item object, used by some events.                  

      See also :meth:`wx.ListCtrl.SetItem` .                  

      :rtype: :ref:`wx.ListItem`








   .. method:: GetKeyCode(self)

      Key code if the event is a keypress event.                  

      :rtype: `int`








   .. method:: GetLabel(self)

      The (new) item label for  ``EVT_LIST_END_LABEL_EDIT``   event.                   

      :rtype: `string`








   .. method:: GetMask(self)

      The mask.                  

      :rtype: `long`








   .. method:: GetPoint(self)

      The position of the mouse pointer if the event is a drag event.                  

      :rtype: :ref:`wx.Point`








   .. method:: GetText(self)

      The text.                  

      :rtype: `string`








   .. method:: IsEditCancelled(self)

      This method only makes sense for  ``EVT_LIST_END_LABEL_EDIT``   message and returns ``True`` if it the label editing has been cancelled by the user (:meth:`GetLabel`   returns an empty string in this case but it doesn't allow the application to distinguish between really cancelling the edit and the admittedly rare case when the user wants to rename it to an empty string).                  

      :rtype: `bool`








   .. method:: SetCacheFrom(self, cacheFrom)



                


      :param `cacheFrom`: 
      :type `cacheFrom`: long






      .. seealso:: :meth:`GetCacheFrom`     








   .. method:: SetCacheTo(self, cacheTo)



                


      :param `cacheTo`: 
      :type `cacheTo`: long






      .. seealso:: :meth:`GetCacheTo`     








   .. method:: SetColumn(self, col)



                


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






      .. seealso:: :meth:`GetColumn`     








   .. method:: SetIndex(self, index)



                


      :param `index`: 
      :type `index`: long






      .. seealso:: :meth:`GetIndex`     








   .. method:: SetItem(self, item)



                


      :param `item`: 
      :type `item`: wx.ListItem






      .. seealso:: :meth:`GetItem`     








   .. method:: SetKeyCode(self, code)



                


      :param `code`: 
      :type `code`: int






      .. seealso:: :meth:`GetKeyCode`     








   .. method:: SetPoint(self, point)



                


      :param `point`: 
      :type `point`: wx.Point






      .. seealso:: :meth:`GetPoint`     








   .. attribute:: CacheFrom

      See :meth:`~wx.ListEvent.GetCacheFrom` and :meth:`~wx.ListEvent.SetCacheFrom`


   .. attribute:: CacheTo

      See :meth:`~wx.ListEvent.GetCacheTo` and :meth:`~wx.ListEvent.SetCacheTo`


   .. attribute:: Column

      See :meth:`~wx.ListEvent.GetColumn` and :meth:`~wx.ListEvent.SetColumn`


   .. attribute:: Data

      See :meth:`~wx.ListEvent.GetData`


   .. attribute:: Image

      See :meth:`~wx.ListEvent.GetImage`


   .. attribute:: Index

      See :meth:`~wx.ListEvent.GetIndex` and :meth:`~wx.ListEvent.SetIndex`


   .. attribute:: Item

      See :meth:`~wx.ListEvent.GetItem` and :meth:`~wx.ListEvent.SetItem`


   .. attribute:: KeyCode

      See :meth:`~wx.ListEvent.GetKeyCode` and :meth:`~wx.ListEvent.SetKeyCode`


   .. attribute:: Label

      See :meth:`~wx.ListEvent.GetLabel`


   .. attribute:: Mask

      See :meth:`~wx.ListEvent.GetMask`


   .. attribute:: Point

      See :meth:`~wx.ListEvent.GetPoint` and :meth:`~wx.ListEvent.SetPoint`


   .. attribute:: Text

      See :meth:`~wx.ListEvent.GetText`

