.. include:: headings.inc .. _ListItem: ========================================================================================================================================== |phoenix_title| **ListItem** ========================================================================================================================================== This class stores information about a :ref:`ListCtrl` item or column. :ref:`ListItem` is a class which contains informations about: - Zero based item position; see :meth:`~ListItem.SetId` and :meth:`~ListItem.GetId`. - Zero based column index; see :meth:`~ListItem.SetColumn` and :meth:`~ListItem.GetColumn`. - The label (or header for columns); see :meth:`~ListItem.SetText` and :meth:`~ListItem.GetText`. - The zero based index into an image list; see :meth:`~ListItem.GetImage` and :meth:`~ListItem.SetImage`. - Application defined data; see :meth:`~ListItem.SetData` and :meth:`~ListItem.GetData`. - For columns only: the width of the column; see :meth:`~ListItem.SetWidth` and :meth:`~ListItem.GetWidth`. - For columns only: the format of the column; one of ``LIST_FORMAT_LEFT`` , ``LIST_FORMAT_RIGHT`` , ``LIST_FORMAT_CENTRE`` . See :meth:`~ListItem.SetAlign` and :meth:`~ListItem.GetAlign`. - The state of the item; see :meth:`~ListItem.SetState` and :meth:`~ListItem.GetState`. This is a bitlist of the following flags: - ``LIST_STATE_FOCUSED:`` The item has the focus. - ``LIST_STATE_SELECTED:`` The item is selected. - ``LIST_STATE_DONTCARE:`` Don't care what the state is. Win32 only. - ``LIST_STATE_DROPHILITED:`` The item is highlighted to receive a drop event. Win32 only. - ``LIST_STATE_CUT:`` The item is in the cut state. Win32 only. - A mask indicating which state flags are valid; this is a bitlist of the flags reported above for the item state. See :meth:`~ListItem.SetStateMask` and GetStateMask(). - A mask indicating which fields of this class are valid; see :meth:`~ListItem.SetMask` and :meth:`~ListItem.GetMask`. This is a bitlist of the following flags: - ``LIST_MASK_STATE:`` The state field is valid. - ``LIST_MASK_TEXT:`` The label field is valid. - ``LIST_MASK_IMAGE:`` The image field is valid. - ``LIST_MASK_DATA:`` The application-defined data field is valid. - ``LIST_MASK_WIDTH:`` The column width field is valid. - ``LIST_MASK_FORMAT:`` The column format field is valid. The :ref:`ListItem` object can also contain item-specific colour and font information: for this you need to call one of :meth:`~ListItem.SetTextColour`, :meth:`~ListItem.SetBackgroundColour` or :meth:`~ListItem.SetFont` functions on it passing it the colour/font to use. If the colour/font is not specified, the default list control colour/font is used. .. seealso:: :ref:`ListCtrl` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **ListItem** .. raw:: html

Inheritance diagram of ListItem

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~ListItem.__init__` Constructor. :meth:`~ListItem.Clear` Resets the item state to the default. :meth:`~ListItem.GetAlign` Returns the alignment for this item. :meth:`~ListItem.GetBackgroundColour` Returns the background colour for this item. :meth:`~ListItem.GetColumn` Returns the zero-based column; meaningful only in report mode. :meth:`~ListItem.GetData` Returns client data associated with the control. :meth:`~ListItem.GetFont` Returns the font used to display the item. :meth:`~ListItem.GetId` Returns the zero-based item position. :meth:`~ListItem.GetImage` Returns the zero-based index of the image associated with the item into the image list. :meth:`~ListItem.GetMask` Returns a bit mask indicating which fields of the structure are valid. :meth:`~ListItem.GetState` Returns a bit field representing the state of the item. :meth:`~ListItem.GetText` Returns the label/header text. :meth:`~ListItem.GetTextColour` Returns the text colour. :meth:`~ListItem.GetWidth` Meaningful only for column headers in report mode. :meth:`~ListItem.SetAlign` Sets the alignment for the item. :meth:`~ListItem.SetBackgroundColour` Sets the background colour for the item. :meth:`~ListItem.SetColumn` Sets the zero-based column. :meth:`~ListItem.SetData` Sets client data for the item. :meth:`~ListItem.SetFont` Sets the font for the item. :meth:`~ListItem.SetId` Sets the zero-based item position. :meth:`~ListItem.SetImage` Sets the zero-based index of the image associated with the item into the image list. :meth:`~ListItem.SetMask` Sets the mask of valid fields. :meth:`~ListItem.SetState` Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see :meth:`ListItem.SetStateMask` ). :meth:`~ListItem.SetStateMask` Sets the bitmask that is used to determine which of the state flags are to be set. :meth:`~ListItem.SetText` Sets the text label for the item. :meth:`~ListItem.SetTextColour` Sets the text colour for the item. :meth:`~ListItem.SetWidth` Meaningful only for column headers in report mode. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~ListItem.Align` See :meth:`~ListItem.GetAlign` and :meth:`~ListItem.SetAlign` :attr:`~ListItem.BackgroundColour` See :meth:`~ListItem.GetBackgroundColour` and :meth:`~ListItem.SetBackgroundColour` :attr:`~ListItem.Column` See :meth:`~ListItem.GetColumn` and :meth:`~ListItem.SetColumn` :attr:`~ListItem.Data` See :meth:`~ListItem.GetData` and :meth:`~ListItem.SetData` :attr:`~ListItem.Font` See :meth:`~ListItem.GetFont` and :meth:`~ListItem.SetFont` :attr:`~ListItem.Id` See :meth:`~ListItem.GetId` and :meth:`~ListItem.SetId` :attr:`~ListItem.Image` See :meth:`~ListItem.GetImage` and :meth:`~ListItem.SetImage` :attr:`~ListItem.Mask` See :meth:`~ListItem.GetMask` and :meth:`~ListItem.SetMask` :attr:`~ListItem.State` See :meth:`~ListItem.GetState` and :meth:`~ListItem.SetState` :attr:`~ListItem.Text` See :meth:`~ListItem.GetText` and :meth:`~ListItem.SetText` :attr:`~ListItem.TextColour` See :meth:`~ListItem.GetTextColour` and :meth:`~ListItem.SetTextColour` :attr:`~ListItem.Width` See :meth:`~ListItem.GetWidth` and :meth:`~ListItem.SetWidth` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ListItem(Object) This class stores information about a ListCtrl item or column. **Possible constructors**:: ListItem() .. method:: __init__(self) Constructor. .. method:: Clear(self) Resets the item state to the default. .. method:: GetAlign(self) Returns the alignment for this item. Can be one of ``LIST_FORMAT_LEFT`` , ``LIST_FORMAT_RIGHT`` or ``LIST_FORMAT_CENTRE`` . :rtype: :ref:`ListColumnFormat` .. method:: GetBackgroundColour(self) Returns the background colour for this item. :rtype: :ref:`Colour` .. method:: GetColumn(self) Returns the zero-based column; meaningful only in report mode. :rtype: `int` .. method:: GetData(self) Returns client data associated with the control. Please note that client data is associated with the item and not with subitems. :rtype: `long` .. method:: GetFont(self) Returns the font used to display the item. :rtype: :ref:`Font` .. method:: GetId(self) Returns the zero-based item position. :rtype: `long` .. method:: GetImage(self) Returns the zero-based index of the image associated with the item into the image list. :rtype: `int` .. method:: GetMask(self) Returns a bit mask indicating which fields of the structure are valid. Can be any combination of the following values: - ``LIST_MASK_STATE``: **GetState** is valid. - ``LIST_MASK_TEXT``: **GetText** is valid. - ``LIST_MASK_IMAGE``: **GetImage** is valid. - ``LIST_MASK_DATA``: **GetData** is valid. - ``LIST_MASK_WIDTH``: **GetWidth** is valid. - ``LIST_MASK_FORMAT``: **GetFormat** is valid. :rtype: `long` .. method:: GetState(self) Returns a bit field representing the state of the item. Can be any combination of: - ``LIST_STATE_DONTCARE``: Don't care what the state is. Win32 only. - ``LIST_STATE_DROPHILITED``: The item is highlighted to receive a drop event. Win32 only. - ``LIST_STATE_FOCUSED``: The item has the focus. - ``LIST_STATE_SELECTED``: The item is selected. - ``LIST_STATE_CUT``: The item is in the cut state. Win32 only. :rtype: `long` .. method:: GetText(self) Returns the label/header text. :rtype: `string` .. method:: GetTextColour(self) Returns the text colour. :rtype: :ref:`Colour` .. method:: GetWidth(self) Meaningful only for column headers in report mode. Returns the column width. :rtype: `int` .. method:: SetAlign(self, align) Sets the alignment for the item. See also :meth:`GetAlign` :param `align`: :type `align`: ListColumnFormat .. method:: SetBackgroundColour(self, colBack) Sets the background colour for the item. :param `colBack`: :type `colBack`: Colour .. method:: SetColumn(self, col) Sets the zero-based column. Meaningful only in report mode. :param `col`: :type `col`: int .. method:: SetData(self, *args, **kw) Sets client data for the item. Please note that client data is associated with the item and not with subitems. .. method:: SetFont(self, font) Sets the font for the item. :param `font`: :type `font`: Font .. method:: SetId(self, id) Sets the zero-based item position. :param `id`: :type `id`: long .. method:: SetImage(self, image) Sets the zero-based index of the image associated with the item into the image list. :param `image`: :type `image`: int .. method:: SetMask(self, mask) Sets the mask of valid fields. See :meth:`GetMask` . :param `mask`: :type `mask`: long .. method:: SetState(self, state) Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see :meth:`ListItem.SetStateMask` ). See :meth:`GetState` for valid flag values. :param `state`: :type `state`: long .. method:: SetStateMask(self, stateMask) Sets the bitmask that is used to determine which of the state flags are to be set. See also :meth:`SetState` . :param `stateMask`: :type `stateMask`: long .. method:: SetText(self, text) Sets the text label for the item. :param `text`: :type `text`: string .. method:: SetTextColour(self, colText) Sets the text colour for the item. :param `colText`: :type `colText`: Colour .. method:: SetWidth(self, width) Meaningful only for column headers in report mode. Sets the column width. :param `width`: :type `width`: int .. attribute:: Align See :meth:`~ListItem.GetAlign` and :meth:`~ListItem.SetAlign` .. attribute:: BackgroundColour See :meth:`~ListItem.GetBackgroundColour` and :meth:`~ListItem.SetBackgroundColour` .. attribute:: Column See :meth:`~ListItem.GetColumn` and :meth:`~ListItem.SetColumn` .. attribute:: Data See :meth:`~ListItem.GetData` and :meth:`~ListItem.SetData` .. attribute:: Font See :meth:`~ListItem.GetFont` and :meth:`~ListItem.SetFont` .. attribute:: Id See :meth:`~ListItem.GetId` and :meth:`~ListItem.SetId` .. attribute:: Image See :meth:`~ListItem.GetImage` and :meth:`~ListItem.SetImage` .. attribute:: Mask See :meth:`~ListItem.GetMask` and :meth:`~ListItem.SetMask` .. attribute:: State See :meth:`~ListItem.GetState` and :meth:`~ListItem.SetState` .. attribute:: Text See :meth:`~ListItem.GetText` and :meth:`~ListItem.SetText` .. attribute:: TextColour See :meth:`~ListItem.GetTextColour` and :meth:`~ListItem.SetTextColour` .. attribute:: Width See :meth:`~ListItem.GetWidth` and :meth:`~ListItem.SetWidth`