phoenix_title wx.dataview.DataViewListCtrl

This class is a wx.dataview.DataViewCtrl which internally uses a 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 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)

styles Window Styles

This class supports the following styles:

See wx.dataview.DataViewCtrl for the list of supported styles.

events Events Emitted by this Class

Event macros for events emitted by this class:

See wx.dataview.DataViewCtrl for the list of events emitted by this class.

New in version 2.9.0.


class_hierarchy Class Hierarchy

Inheritance diagram for class DataViewListCtrl:

method_summary Methods Summary

__init__

Default constructor.

AppendColumn

Appends a column to the control and additionally appends a column to the store with the type string.

AppendIconTextColumn

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

AppendItem

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

AppendProgressColumn

Appends a progress column to the control and the store.

AppendTextColumn

Appends a text column to the control and the store.

AppendToggleColumn

Appends a toggle column to the control and the store.

Create

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

DeleteAllItems

Delete all items (= all rows).

DeleteItem

Delete the row at position row.

GetClassDefaultAttributes

GetItemCount

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

GetItemData

Returns the client data associated with the item.

GetSelectedRow

Returns index of the selected row or wx.NOT_FOUND.

GetStore

Returns the store.

GetTextValue

Returns the value from the store.

GetToggleValue

Returns the value from the store.

GetValue

Returns the value from the store.

InsertColumn

Inserts a column to the control and additionally inserts a column to the store with the type string.

InsertItem

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

IsRowSelected

Returns True if row is selected.

ItemToRow

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

PrependColumn

Prepends a column to the control and additionally prepends a column to the store with the type string.

PrependItem

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

RowToItem

Returns the wx.dataview.DataViewItem at the given row.

SelectRow

Selects given row.

SetItemData

Associates a client data pointer with the given item.

SetTextValue

Sets the value in the store and update the control.

SetToggleValue

Sets the value in the store and update the control.

SetValue

Sets the value in the store and update the control.

UnselectRow

Unselects given row.


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.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)

Constructor.

Calls Create .

Parameters





AppendColumn(self, *args, **kw)

overload Overloaded Implementations:



AppendColumn (self, column)

Appends a column to the control and additionally appends a column to the store with the type string.

Parameters

column (wx.dataview.DataViewColumn) –

Return type

bool



AppendColumn (self, column, varianttype)

Appends a column to the control and additionally appends a column to the list store with the type varianttype.

Parameters





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 DataViewColumn.__init__ for more info about the parameters.

Parameters
Return type

wx.dataview.DataViewColumn



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).

Parameters
  • values (VariantVector) –

  • data (wx.UIntPtr) –



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 DataViewColumn.__init__ for more info about the parameters.

Parameters
Return type

wx.dataview.DataViewColumn



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 DataViewColumn.__init__ for more info about the parameters.

Parameters
Return type

wx.dataview.DataViewColumn



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 DataViewColumn.__init__ for more info about the parameters.

Parameters
Return type

wx.dataview.DataViewColumn



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

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

Parameters
Return type

bool



DeleteAllItems(self)

Delete all items (= all rows).



DeleteItem(self, row)

Delete the row at position row.

Parameters

row



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters

variant (WindowVariant) –

Return type

VisualAttributes



GetItemCount(self)

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

Return type

int

New in version 2.9.4.



GetItemData(self, item)

Returns the client data associated with the item.

Parameters

item (wx.dataview.DataViewItem) –

Return type

wx.UIntPtr

New in version 2.9.4.

See also

SetItemData



GetSelectedRow(self)

Returns index of the selected row or wx.NOT_FOUND.

Return type

int

New in version 2.9.2.



GetStore(self)

Returns the store.

Return type

wx.dataview.DataViewListStore



GetTextValue(self, row, col)

Returns the value from the store.

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

Parameters
  • row (int) –

  • col (int) –

Return type

string



GetToggleValue(self, row, col)

Returns the value from the store.

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

Parameters
  • row (int) –

  • col (int) –

Return type

bool



GetValue(self, row, col)

Returns the value from the store.

Parameters
  • row (int) –

  • col (int) –

Return type

value



InsertColumn(self, *args, **kw)

overload Overloaded Implementations:



InsertColumn (self, pos, column)

Inserts a column to the control and additionally inserts a column to the store with the type string.

Parameters
Return type

bool



InsertColumn (self, pos, column, varianttype)

Inserts a column to the control and additionally inserts a column to the list store with the type varianttype.

Parameters





InsertItem(self, row, values, data=None)

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

See remarks for AppendItem for preconditions of this method.

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

Parameters
  • row (int) –

  • values (VariantVector) –

  • data (wx.UIntPtr) –



IsRowSelected(self, row)

Returns True if row is selected.

Parameters

row

Return type

bool

New in version 2.9.2.



ItemToRow(self, item)

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

Parameters

item (wx.dataview.DataViewItem) –

Return type

int

New in version 2.9.2.



PrependColumn(self, *args, **kw)

overload Overloaded Implementations:



PrependColumn (self, column)

Prepends a column to the control and additionally prepends a column to the store with the type string.

Parameters

column (wx.dataview.DataViewColumn) –

Return type

bool



PrependColumn (self, column, varianttype)

Prepends a column to the control and additionally prepends a column to the list store with the type varianttype.

Parameters





PrependItem(self, values, data=None)

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

See remarks for AppendItem for preconditions of this method.

Parameters
  • values (VariantVector) –

  • data (wx.UIntPtr) –



RowToItem(self, row)

Returns the wx.dataview.DataViewItem at the given row.

Parameters

row (int) –

Return type

wx.dataview.DataViewItem

New in version 2.9.2.



SelectRow(self, row)

Selects given row.

Parameters

row

New in version 2.9.2.



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

Parameters

New in version 2.9.4.

See also

GetItemData



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.

Parameters
  • value (string) –

  • row (int) –

  • col (int) –



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.

Parameters
  • value (bool) –

  • row (int) –

  • col (int) –



SetValue(self, value, row, col)

Sets the value in the store and update the control.

Parameters
  • value (DVCVariant) –

  • row (int) –

  • col (int) –



UnselectRow(self, row)

Unselects given row.

Parameters

row

New in version 2.9.2.


Properties

ItemCount

See GetItemCount



SelectedRow

See GetSelectedRow



Store

See GetStore