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

==========================================================================================================================================
|phoenix_title|  **wx.dataview.DataViewListCtrl**
==========================================================================================================================================

This class is a :ref:`wx.dataview.DataViewCtrl`  which internally uses a :ref:`wx.dataview.DataViewListStore`  and forwards most of its API to that class.          

The purpose of this class is to offer a simple way to display and edit a small table of data without having to write your own :ref:`wx.dataview.DataViewModel`. 

::

    listctrl = wx.dataview.DataViewListCtrl(parent, wx.ID_ANY)

    listctrl.AppendToggleColumn("Toggle")
    listctrl.AppendTextColumn("Text")

    data = [True, "row 1"]
    listctrl.AppendItem(data)

    data = [False, "row 3"]
    listctrl.AppendItem(data)



^^ 



.. _DataViewListCtrl-styles:

|styles| Window Styles
================================

This class supports the following styles: 

  See :ref:`wx.dataview.DataViewCtrl`  for the list of supported styles. ^^ 

^^ 



.. _DataViewListCtrl-events:

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

Event macros for events emitted by this class: 

  See :ref:`wx.dataview.DataViewCtrl`  for the list of events emitted by this class. ^^ 





         



.. versionadded:: 2.9.0 
     







|

|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>DataViewListCtrl</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.DataViewListCtrl_inheritance.png" alt="Inheritance diagram of DataViewListCtrl" 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.DataViewListCtrl.html" title="wx.dataview.DataViewListCtrl" alt="" coords="5,392,223,421"/> <area shape="rect" id="node2" href="wx.dataview.DataViewCtrl.html" title="wx.dataview.DataViewCtrl" alt="" coords="17,315,211,344"/> <area shape="rect" id="node3" href="wx.Control.html" title="wx.Control" alt="" coords="68,237,160,267"/> <area shape="rect" id="node4" href="wx.Window.html" title="wx.Window" alt="" coords="65,160,163,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="55,83,173,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="11,5,97,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="122,5,229,35"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewListCtrl.__init__`                                   Default constructor.
:meth:`~wx.dataview.DataViewListCtrl.AppendColumn`                               Appends a column to the control and additionally appends a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.AppendIconTextColumn`                       Appends an icon-and-text column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendItem`                                 Appends an item (i.e. a row) to the control.
:meth:`~wx.dataview.DataViewListCtrl.AppendProgressColumn`                       Appends a progress column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendTextColumn`                           Appends a text column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendToggleColumn`                         Appends a toggle column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.Create`                                     Creates the control and a :ref:`wx.dataview.DataViewListStore`  as its internal model.
:meth:`~wx.dataview.DataViewListCtrl.DeleteAllItems`                             Delete all items (= all rows).
:meth:`~wx.dataview.DataViewListCtrl.DeleteItem`                                 Delete the row at position `row`.
:meth:`~wx.dataview.DataViewListCtrl.GetClassDefaultAttributes`                  
:meth:`~wx.dataview.DataViewListCtrl.GetItemCount`                               Returns the number of items (=rows) in the control.
:meth:`~wx.dataview.DataViewListCtrl.GetItemData`                                Returns the client data associated with the item.
:meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow`                             Returns index of the selected row or ``wx.NOT_FOUND``.
:meth:`~wx.dataview.DataViewListCtrl.GetStore`                                   Returns the store.
:meth:`~wx.dataview.DataViewListCtrl.GetTextValue`                               Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.GetToggleValue`                             Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.GetValue`                                   Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.InsertColumn`                               Inserts a column to the control and additionally inserts a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.InsertItem`                                 Inserts an item (i.e. a row) to the control.
:meth:`~wx.dataview.DataViewListCtrl.IsRowSelected`                              Returns ``True`` if `row`  is selected.
:meth:`~wx.dataview.DataViewListCtrl.ItemToRow`                                  Returns the position of given `item`  or ``wx.NOT_FOUND`` if it's not a valid item.
:meth:`~wx.dataview.DataViewListCtrl.PrependColumn`                              Prepends a column to the control and additionally prepends a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.PrependItem`                                Prepends an item (i.e. a row) to the control.
:meth:`~wx.dataview.DataViewListCtrl.RowToItem`                                  Returns the :ref:`wx.dataview.DataViewItem`  at the given `row`.
:meth:`~wx.dataview.DataViewListCtrl.SelectRow`                                  Selects given row.
:meth:`~wx.dataview.DataViewListCtrl.SetItemData`                                Associates a client data pointer with the given item.
:meth:`~wx.dataview.DataViewListCtrl.SetTextValue`                               Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.SetToggleValue`                             Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.SetValue`                                   Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.UnselectRow`                                Unselects given row.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.dataview.DataViewListCtrl.ItemCount`                                  See :meth:`~wx.dataview.DataViewListCtrl.GetItemCount`
:attr:`~wx.dataview.DataViewListCtrl.SelectedRow`                                See :meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow`
:attr:`~wx.dataview.DataViewListCtrl.Store`                                      See :meth:`~wx.dataview.DataViewListCtrl.GetStore`
================================================================================ ================================================================================


|


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


.. class:: wx.dataview.DataViewListCtrl(DataViewCtrl)

   **Possible constructors**::

       DataViewListCtrl()
       
       DataViewListCtrl(parent, id=ID_ANY, pos=DefaultPosition,
                        size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)
       
   
   This class is a DataViewCtrl which internally uses a
   DataViewListStore and forwards most of its API to that class.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)`
      
      Constructor.                  
      
      Calls :meth:`Create` .                  
      
      
      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `validator`: 
      :type `validator`: wx.Validator
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AppendColumn(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **AppendColumn** `(self, column)`
      
      Appends a column to the control and additionally appends a column to the store with the type string.                  
      
      
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **AppendColumn** `(self, column, varianttype)`
      
      Appends a column to the control and additionally appends a column to the list store with the type `varianttype`.                  
      
      
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      :param `varianttype`: 
      :type `varianttype`: string
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AppendIconTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)

      Appends an icon-and-text column to the control and the store.                  

      See :meth:`DataViewColumn.__init__`   for more info about the parameters.                  


      :param `label`: 
      :type `label`: string
      :param `mode`: 
      :type `mode`: wx.dataview.DataViewCellMode
      :param `width`: 
      :type `width`: int
      :param `align`: 
      :type `align`: wx.Alignment
      :param `flags`: 
      :type `flags`: int




      :rtype: :ref:`wx.dataview.DataViewColumn`








   .. method:: AppendItem(self, values, data=None)

      Appends an item (i.e. a row) to the control.                  

      Note that the size of `values`  vector must be exactly equal to the number of columns in the control and that columns must not be modified after adding any items to the control (or, conversely, items must not be added before the columns are set up).                  


      :param `values`: 
      :type `values`: :class:`VariantVector`
      :param `data`: 
      :type `data`: wx.UIntPtr







   .. method:: AppendProgressColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)

      Appends a progress column to the control and the store.                  

      See :meth:`DataViewColumn.__init__`   for more info about the parameters.                  


      :param `label`: 
      :type `label`: string
      :param `mode`: 
      :type `mode`: wx.dataview.DataViewCellMode
      :param `width`: 
      :type `width`: int
      :param `align`: 
      :type `align`: wx.Alignment
      :param `flags`: 
      :type `flags`: int




      :rtype: :ref:`wx.dataview.DataViewColumn`








   .. method:: AppendTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)

      Appends a text column to the control and the store.                  

      See :meth:`DataViewColumn.__init__`   for more info about the parameters.                  


      :param `label`: 
      :type `label`: string
      :param `mode`: 
      :type `mode`: wx.dataview.DataViewCellMode
      :param `width`: 
      :type `width`: int
      :param `align`: 
      :type `align`: wx.Alignment
      :param `flags`: 
      :type `flags`: int




      :rtype: :ref:`wx.dataview.DataViewColumn`








   .. method:: AppendToggleColumn(self, label, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)

      Appends a toggle column to the control and the store.                  

      See :meth:`DataViewColumn.__init__`   for more info about the parameters.                  


      :param `label`: 
      :type `label`: string
      :param `mode`: 
      :type `mode`: wx.dataview.DataViewCellMode
      :param `width`: 
      :type `width`: int
      :param `align`: 
      :type `align`: wx.Alignment
      :param `flags`: 
      :type `flags`: int




      :rtype: :ref:`wx.dataview.DataViewColumn`








   .. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)

      Creates the control and a :ref:`wx.dataview.DataViewListStore`  as its internal model.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `validator`: 
      :type `validator`: wx.Validator




      :rtype: `bool`








   .. method:: DeleteAllItems(self)

      Delete all items (= all rows).                   





   .. method:: DeleteItem(self, row)

      Delete the row at position `row`.                  


      :param `row`: 







   .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)




      :param `variant`: 
      :type `variant`: wx.WindowVariant




      :rtype: :ref:`VisualAttributes`








   .. method:: GetItemCount(self)

      Returns the number of items (=rows) in the control.                  

                

      :rtype: `int`







      .. versionadded:: 2.9.4 
     








   .. method:: GetItemData(self, item)

      Returns the client data associated with the item.                  

                


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




      :rtype: :ref:`wx.UIntPtr`







      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`SetItemData`   








   .. method:: GetSelectedRow(self)

      Returns index of the selected row or ``wx.NOT_FOUND``.                  

                

      :rtype: `int`







      .. versionadded:: 2.9.2 
     







      .. seealso:: :meth:`wx.dataview.DataViewCtrl.GetSelection`   








   .. method:: GetStore(self)

      Returns the store.                  

      :rtype: :ref:`wx.dataview.DataViewListStore`








   .. method:: GetTextValue(self, row, col)

      Returns the value from the store.                  

      This method assumes that the string is stored in respective column.                  


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




      :rtype: `string`








   .. method:: GetToggleValue(self, row, col)

      Returns the value from the store.                  

      This method assumes that the boolean value is stored in respective column.                  


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




      :rtype: `bool`








   .. method:: GetValue(self, row, col)

      Returns the value from the store.                  


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




      :rtype: `value`








   .. method:: InsertColumn(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **InsertColumn** `(self, pos, column)`
      
      Inserts a column to the control and additionally inserts a column to the store with the type string.                  
      
      
      :param `pos`: 
      :type `pos`: int
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **InsertColumn** `(self, pos, column, varianttype)`
      
      Inserts a column to the control and additionally inserts a column to the list store with the type `varianttype`.                  
      
      
      :param `pos`: 
      :type `pos`: int
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      :param `varianttype`: 
      :type `varianttype`: string
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: InsertItem(self, row, values, data=None)

      Inserts an item (i.e. a row) to the control.                  

      See remarks for :meth:`AppendItem`   for preconditions of this method. 

      Additionally, `row`  must be less than or equal to the current number of items in the control (see :meth:`GetItemCount` ).                  


      :param `row`: 
      :type `row`: int
      :param `values`: 
      :type `values`: :class:`VariantVector`
      :param `data`: 
      :type `data`: wx.UIntPtr







   .. method:: IsRowSelected(self, row)

      Returns ``True`` if `row`  is selected.                  

                


      :param `row`: 




      :rtype: `bool`







      .. versionadded:: 2.9.2 
     







      .. seealso:: :meth:`wx.dataview.DataViewCtrl.IsSelected`   








   .. method:: ItemToRow(self, item)

      Returns the position of given `item`  or ``wx.NOT_FOUND`` if it's not a valid item.                  

                


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




      :rtype: `int`







      .. versionadded:: 2.9.2 
     








   .. method:: PrependColumn(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **PrependColumn** `(self, column)`
      
      Prepends a column to the control and additionally prepends a column to the store with the type string.                  
      
      
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **PrependColumn** `(self, column, varianttype)`
      
      Prepends a column to the control and additionally prepends a column to the list store with the type `varianttype`.                  
      
      
      :param `column`: 
      :type `column`: wx.dataview.DataViewColumn
      :param `varianttype`: 
      :type `varianttype`: string
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: PrependItem(self, values, data=None)

      Prepends an item (i.e. a row) to the control.                  

      See remarks for :meth:`AppendItem`   for preconditions of this method.                  


      :param `values`: 
      :type `values`: :class:`VariantVector`
      :param `data`: 
      :type `data`: wx.UIntPtr







   .. method:: RowToItem(self, row)

      Returns the :ref:`wx.dataview.DataViewItem`  at the given `row`.                  

                


      :param `row`: 
      :type `row`: int




      :rtype: :ref:`wx.dataview.DataViewItem`







      .. versionadded:: 2.9.2 
     








   .. method:: SelectRow(self, row)

      Selects given row.                  

                


      :param `row`: 






      .. versionadded:: 2.9.2 
     







      .. seealso:: :meth:`wx.dataview.DataViewCtrl.Select`   








   .. method:: SetItemData(self, item, data)

      Associates a client data pointer with the given item.                  

      Notice that the control does `not`  take ownership of the pointer for compatibility with :ref:`wx.ListCtrl`. I.e. it will `not`  delete the pointer (if it is a pointer and not a number) itself, it is up to you to do it. 

                


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






      .. versionadded:: 2.9.4 
     







      .. seealso:: :meth:`GetItemData`   








   .. method:: SetTextValue(self, value, row, col)

      Sets the value in the store and update the control.                  

      This method assumes that the string is stored in respective column.                  


      :param `value`: 
      :type `value`: string
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int







   .. method:: SetToggleValue(self, value, row, col)

      Sets the value in the store and update the control.                  

      This method assumes that the boolean value is stored in respective column.                  


      :param `value`: 
      :type `value`: bool
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int







   .. method:: SetValue(self, value, row, col)

      Sets the value in the store and update the control.                  


      :param `value`: 
      :type `value`: DVCVariant
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int







   .. method:: UnselectRow(self, row)

      Unselects given row.                  

                


      :param `row`: 






      .. versionadded:: 2.9.2 
     







      .. seealso:: :meth:`wx.dataview.DataViewCtrl.Unselect`   








   .. attribute:: ItemCount

      See :meth:`~wx.dataview.DataViewListCtrl.GetItemCount`


   .. attribute:: SelectedRow

      See :meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow`


   .. attribute:: Store

      See :meth:`~wx.dataview.DataViewListCtrl.GetStore`

