.. include:: headings.inc .. _ListView: ========================================================================================================================================== |phoenix_title| **ListView** ========================================================================================================================================== This class currently simply presents a simpler to use interface for the :ref:`ListCtrl` -- it can be thought of as a `façade` for that complicated class. Using it is preferable to using :ref:`ListCtrl` directly whenever possible because in the future some ports might implement :ref:`ListView` but not the full set of :ref:`ListCtrl` features. Other than different interface, this class is identical to :ref:`ListCtrl`. In particular, it uses the same events, same window styles and so on. .. seealso:: :meth:`ListView.SetColumnImage` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **ListView** .. raw:: html

Inheritance diagram of ListView

| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/../no_appearance.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/listview.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~ListView.ClearColumnImage` Resets the column image -- after calling this function, no image will be shown. :meth:`~ListView.Focus` Sets focus to the item with the given `index`. :meth:`~ListView.GetFirstSelected` Returns the first selected item in a (presumably) multiple selection control. :meth:`~ListView.GetFocusedItem` Returns the currently focused item or -1 if none. :meth:`~ListView.GetNextSelected` Used together with :meth:`GetFirstSelected` to iterate over all selected items in the control. :meth:`~ListView.IsSelected` Returns ``True`` if the item with the given `index` is selected, ``False`` otherwise. :meth:`~ListView.Select` Selects or unselects the given item. :meth:`~ListView.SetColumnImage` Sets the column image for the specified column. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~ListView.FirstSelected` See :meth:`~ListView.GetFirstSelected` :attr:`~ListView.FocusedItem` See :meth:`~ListView.GetFocusedItem` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ListView(ListCtrl) This class currently simply presents a simpler to use interface for the ListCtrl -- it can be thought of as a façade for that complicated class. .. method:: ClearColumnImage(self, col) Resets the column image -- after calling this function, no image will be shown. :param `col`: the column to clear image for :type `col`: int .. seealso:: :meth:`SetColumnImage` .. method:: Focus(self, index) Sets focus to the item with the given `index`. :param `index`: :type `index`: long .. method:: GetFirstSelected(self) Returns the first selected item in a (presumably) multiple selection control. Together with :meth:`GetNextSelected` it can be used to iterate over all selected items in the control. :rtype: `long` :returns: The first selected item, if any, -1 otherwise. .. method:: GetFocusedItem(self) Returns the currently focused item or -1 if none. :rtype: `long` .. seealso:: :meth:`IsSelected` , :meth:`Focus` .. method:: GetNextSelected(self, item) Used together with :meth:`GetFirstSelected` to iterate over all selected items in the control. :param `item`: :type `item`: long :rtype: `long` :returns: Returns the next selected item or -1 if there are no more of them. .. method:: IsSelected(self, index) Returns ``True`` if the item with the given `index` is selected, ``False`` otherwise. :param `index`: :type `index`: long :rtype: `bool` .. seealso:: :meth:`GetFirstSelected` , :meth:`GetNextSelected` .. method:: Select(self, n, on=True) Selects or unselects the given item. :param `n`: the item to select or unselect :type `n`: long :param `on`: if ``True`` (default), selects the item, otherwise unselects it :type `on`: bool .. seealso:: :meth:`ListCtrl.SetItemState` .. method:: SetColumnImage(self, col, image) Sets the column image for the specified column. To use the column images, the control must have a valid image list with at least one image. :param `col`: the column to set image for :type `col`: int :param `image`: the index of the column image in the controls image list :type `image`: int .. attribute:: FirstSelected See :meth:`~ListView.GetFirstSelected` .. attribute:: FocusedItem See :meth:`~ListView.GetFocusedItem`