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)
Window Styles¶
This class supports the following styles:
See wx.dataview.DataViewCtrl for the list of supported styles.
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.
Added in version 2.9.0.
Class Hierarchy¶
Methods Summary¶
Default constructor. |
|
Appends a column to the control and additionally appends a column to the store with the type string. |
|
Appends an icon-and-text column to the control and the store. |
|
Appends an item (i.e. a row) to the control. |
|
Appends a progress column to the control and the store. |
|
Appends a text column to the control and the store. |
|
Appends a toggle column to the control and the store. |
|
Creates the control and a wx.dataview.DataViewListStore as its internal model. |
|
Delete all items (= all rows). |
|
Delete the row at position row. |
|
Returns the number of items (=rows) in the control. |
|
Returns the client data associated with the item. |
|
Returns index of the selected row or |
|
Returns the store. |
|
Returns the value from the store. |
|
Returns the value from the store. |
|
Returns the value from the store. |
|
Inserts a column to the control and additionally inserts a column to the store with the type string. |
|
Inserts an item (i.e. a row) to the control. |
|
Returns |
|
Returns the position of given item or |
|
Prepends a column to the control and additionally prepends a column to the store with the type string. |
|
Prepends an item (i.e. a row) to the control. |
|
Returns the wx.dataview.DataViewItem at the given row. |
|
Selects given row. |
|
Associates a client data pointer with the given item. |
|
Sets the value in the store and update the control. |
|
Sets the value in the store and update the control. |
|
Sets the value in the store and update the control. |
|
Unselects given row. |
Properties Summary¶
See |
|
See |
|
See |
Class API¶
- class wx.dataview.DataViewListCtrl(DataViewCtrl)¶
Possible constructors:
DataViewListCtrl() -> None DataViewListCtrl(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator) -> None
This class is a DataViewCtrl which internally uses a DataViewListStore and forwards most of its API to that class.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Default constructor.
- Return type:
None
__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)
Constructor.
Calls
Create
.- Parameters:
parent (wx.Window)
id (wx.WindowID)
pos (wx.Point)
size (wx.Size)
style (long)
validator (wx.Validator)
- Return type:
None
- AppendColumn(self, *args, **kw)¶
-
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:
column (wx.dataview.DataViewColumn)
varianttype (string)
- Return type:
None
- AppendIconTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=COL_WIDTH_DEFAULT, 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:
label (string)
mode (DataViewCellMode)
width (int)
align (Alignment)
flags (int)
- Return type:
- 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)
- Return type:
None
- AppendProgressColumn(self, label, mode=DATAVIEW_CELL_INERT, width=COL_WIDTH_DEFAULT, 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:
label (string)
mode (DataViewCellMode)
width (int)
align (Alignment)
flags (int)
- Return type:
- AppendTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=COL_WIDTH_DEFAULT, 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:
label (string)
mode (DataViewCellMode)
width (int)
align (Alignment)
flags (int)
- Return type:
- AppendToggleColumn(self, label, mode=DATAVIEW_CELL_ACTIVATABLE, width=COL_WIDTH_DEFAULT, 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:
label (string)
mode (DataViewCellMode)
width (int)
align (Alignment)
flags (int)
- Return type:
- 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:
parent (wx.Window)
id (wx.WindowID)
pos (wx.Point)
size (wx.Size)
style (long)
validator (wx.Validator)
- Return type:
bool
- DeleteAllItems(self)¶
Delete all items (= all rows).
- Return type:
None
- DeleteItem(self, row)¶
Delete the row at position row.
- Parameters:
row
- Return type:
None
- 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
Added 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
Added in version 2.9.4.
See also
- GetSelectedRow(self)¶
Returns index of the selected row or
wx.NOT_FOUND
.- Return type:
int
Added in version 2.9.2.
- GetStore(self)¶
Returns the store.
- Return type:
- 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:
str
- 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:
DVCVariant
- InsertColumn(self, *args, **kw)¶
-
InsertColumn (self, pos, column)
Inserts a column to the control and additionally inserts a column to the store with the type string.
- Parameters:
pos (int)
column (wx.dataview.DataViewColumn)
- 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:
pos (int)
column (wx.dataview.DataViewColumn)
varianttype (string)
- Return type:
None
- 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)
- Return type:
None
- IsRowSelected(self, row)¶
Returns
True
if row is selected.- Parameters:
row
- Return type:
bool
Added in version 2.9.2.
See also
- 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
Added in version 2.9.2.
- PrependColumn(self, *args, **kw)¶
-
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:
column (wx.dataview.DataViewColumn)
varianttype (string)
- Return type:
None
- 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)
- Return type:
None
- RowToItem(self, row)¶
Returns the wx.dataview.DataViewItem at the given row.
- Parameters:
row (int)
- Return type:
Added in version 2.9.2.
- SelectRow(self, row)¶
Selects given row.
- Parameters:
row
- Return type:
None
Added in version 2.9.2.
See also
- 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:
item (wx.dataview.DataViewItem)
data (wx.UIntPtr)
- Return type:
None
Added in version 2.9.4.
See also
- 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)
- Return type:
None
- 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)
- Return type:
None
- SetValue(self, value, row, col)¶
Sets the value in the store and update the control.
- Parameters:
value (DVCVariant)
row (int)
col (int)
- Return type:
None
- UnselectRow(self, row)¶
Unselects given row.
- Parameters:
row
- Return type:
None
Added in version 2.9.2.
See also
Properties¶
- ItemCount¶
See
GetItemCount
- SelectedRow¶
See
GetSelectedRow