phoenix_title wx.dataview.DataViewEvent

This is the event class for the wx.dataview.DataViewCtrl notifications.

^^

events Events Emitted by this Class

Handlers bound for the following event types will receive a wx.dataview.DataViewEvent parameter.

  • EVT_DATAVIEW_SELECTION_CHANGED: Process a wxEVT_DATAVIEW_SELECTION_CHANGED event.

  • EVT_DATAVIEW_ITEM_ACTIVATED: Process a wxEVT_DATAVIEW_ITEM_ACTIVATED event.

  • EVT_DATAVIEW_ITEM_EDITING_STARTED: Process a wxEVT_DATAVIEW_ITEM_EDITING_STARTED event.

  • EVT_DATAVIEW_ITEM_EDITING_DONE: Process a wxEVT_DATAVIEW_ITEM_EDITING_DONE event.

  • EVT_DATAVIEW_ITEM_COLLAPSING: Process a wxEVT_DATAVIEW_ITEM_COLLAPSING event.

  • EVT_DATAVIEW_ITEM_COLLAPSED: Process a wxEVT_DATAVIEW_ITEM_COLLAPSED event.

  • EVT_DATAVIEW_ITEM_EXPANDING: Process a wxEVT_DATAVIEW_ITEM_EXPANDING event.

  • EVT_DATAVIEW_ITEM_EXPANDED: Process a wxEVT_DATAVIEW_ITEM_EXPANDED event.

  • EVT_DATAVIEW_ITEM_VALUE_CHANGED: Process a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED event.

  • EVT_DATAVIEW_ITEM_CONTEXT_MENU: Process a wxEVT_DATAVIEW_ITEM_CONTEXT_MENU event.

  • EVT_DATAVIEW_COLUMN_HEADER_CLICK: Process a wxEVT_DATAVIEW_COLUMN_HEADER_CLICK event.

  • EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK: Process a wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK event.

  • EVT_DATAVIEW_COLUMN_SORTED: Process a wxEVT_DATAVIEW_COLUMN_SORTED event.

  • EVT_DATAVIEW_COLUMN_REORDERED: Process a wxEVT_DATAVIEW_COLUMN_REORDERED event. Currently this event is not generated when using the native GTK+ version of the control.

  • EVT_DATAVIEW_ITEM_BEGIN_DRAG: Process a wxEVT_DATAVIEW_ITEM_BEGIN_DRAG event which is generated when the user starts dragging a valid item. This event must be processed and wx.dataview.DataViewEvent.SetDataObject must be called to actually start dragging the item.

  • EVT_DATAVIEW_ITEM_DROP_POSSIBLE: Process a wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE event.

  • EVT_DATAVIEW_ITEM_DROP: Process a wxEVT_DATAVIEW_ITEM_DROP event.

  • EVT_DATAVIEW_CACHE_HINT: Process a wxEVT_DATAVIEW_CACHE_HINT event. ^^


class_hierarchy Class Hierarchy

Inheritance diagram for class DataViewEvent:

method_summary Methods Summary

__init__

Default constructor, normally shouldn’t be used and mostly exists only for backwards compatibility.

GetCacheFrom

Return the first row that will be displayed.

GetCacheTo

Return the last row that will be displayed.

GetColumn

Returns the position of the column in the control or -1 if column field is unavailable for this event.

GetDataBuffer

Gets the data buffer for a drop data transfer

GetDataFormat

Gets the wx.DataFormat during a drop operation.

GetDataObject

GetDataSize

Gets the data size for a drop data transfer.

GetDataViewColumn

Returns a pointer to the wx.dataview.DataViewColumn from which the event was emitted or None.

GetDragFlags

GetDropEffect

Returns the effect the user requested to happen to the dropped data.

GetItem

Returns the item affected by the event.

GetModel

Returns the wx.dataview.DataViewModel associated with the event.

GetPosition

Returns the position of a context menu event in client coordinates.

GetProposedDropIndex

Returns the index of the child item at which an item currently being dragged would be dropped.

GetValue

Returns a reference to a value.

IsEditCancelled

Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.

SetCache

SetColumn

Sets the column index associated with this event.

SetDataBuffer

SetDataFormat

SetDataObject

Set wx.DataObject for data transfer within a drag operation.

SetDataSize

SetDataViewColumn

For wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.

SetDragFlags

Specify the kind of the drag operation to perform.

SetDropEffect

SetItem

SetModel

Sets the dataview model associated with this event.

SetPosition

SetValue

Sets the value associated with this event.


api Class API

class wx.dataview.DataViewEvent(NotifyEvent)

Possible constructors:

DataViewEvent()

DataViewEvent(evtType, dvc, column, item=DataViewItem())

DataViewEvent(evtType, dvc, item)

DataViewEvent(event)

This is the event class for the DataViewCtrl notifications.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor, normally shouldn’t be used and mostly exists only for backwards compatibility.



__init__ (self, evtType, dvc, column, item=DataViewItem())

Constructor for the events affecting columns (and possibly also items).

Parameters



__init__ (self, evtType, dvc, item)

Constructor for the events affecting only the items.

Parameters



__init__ (self, event)

Copy constructor.

Parameters

event (wx.dataview.DataViewEvent) –





GetCacheFrom(self)

Return the first row that will be displayed.

Return type

int



GetCacheTo(self)

Return the last row that will be displayed.

Return type

int



GetColumn(self)

Returns the position of the column in the control or -1 if column field is unavailable for this event.

For wxEVT_DATAVIEW_COLUMN_REORDERED, this is the new position of the column.

Return type

int



GetDataBuffer(self)

Gets the data buffer for a drop data transfer

Return type

PyObject



GetDataFormat(self)

Gets the wx.DataFormat during a drop operation.

Return type

DataFormat



GetDataObject(self)
Return type

DataObject



GetDataSize(self)

Gets the data size for a drop data transfer.

Return type

int



GetDataViewColumn(self)

Returns a pointer to the wx.dataview.DataViewColumn from which the event was emitted or None.

Return type

wx.dataview.DataViewColumn



GetDragFlags(self)
Return type

int



GetDropEffect(self)

Returns the effect the user requested to happen to the dropped data.

This function can be used inside wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE and wxEVT_DATAVIEW_ITEM_DROP handlers and returns whether the user is trying to copy (the return value is wx.DragCopy ) or move (if the return value is wx.DragMove ) the data.

Currently this is only available when using the generic version of wx.dataview.DataViewCtrl (used e.g. under MSW) and always returns wx.DragNone in the GTK and macOS native versions.

Return type

wx.DragResult

New in version 2.9.4.



GetItem(self)

Returns the item affected by the event.

Notice that for wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE and wxEVT_DATAVIEW_ITEM_DROP event handlers, the item may be invalid, indicating that the drop is about to happen outside of the item area.

Return type

wx.dataview.DataViewItem



GetModel(self)

Returns the wx.dataview.DataViewModel associated with the event.

Return type

wx.dataview.DataViewModel



GetPosition(self)

Returns the position of a context menu event in client coordinates.

Return type

Point



GetProposedDropIndex(self)

Returns the index of the child item at which an item currently being dragged would be dropped.

This function can be used from wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE handlers to determine the exact position of the item being dropped.

Note that it currently always returns wx.NOT_FOUND when using native GTK implementation of this control.

Return type

int

New in version 4.1/wxWidgets-3.1.2.



GetValue(self)

Returns a reference to a value.

Return type

DVCVariant



IsEditCancelled(self)

Can be used to determine whether the new value is going to be accepted in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.

Returns True if editing the item was cancelled or if the user tried to enter an invalid value (refused by wx.dataview.DataViewRenderer.Validate ). If this method returns False, it means that the value in the model is about to be changed to the new one.

Notice that wxEVT_DATAVIEW_ITEM_EDITING_DONE event handler can call wx.NotifyEvent.Veto to prevent this from happening.

Currently support for setting this field and for vetoing the change is only available in the generic version of wx.dataview.DataViewCtrl, i.e. under MSW but not GTK nor macOS.

Return type

bool

New in version 2.9.3.



SetCache(self, from_, to_)
Parameters
  • from_ (int) –

  • to_ (int) –



SetColumn(self, col)

Sets the column index associated with this event.

Parameters

col (int) –



SetDataBuffer(self, buf)
Parameters

buf



SetDataFormat(self, format)
Parameters

format (wx.DataFormat) –



SetDataObject(self, obj)

Set wx.DataObject for data transfer within a drag operation.

This method must be used inside a wxEVT_DATAVIEW_ITEM_BEGIN_DRAG handler to associate the data object to be dragged with the item.

Note that the control takes ownership of the data object, i.e. obj must be heap-allocated and will be deleted by wx.dataview.DataViewCtrl itself.

Parameters

obj (wx.DataObject) –



SetDataSize(self, size)
Parameters

size (int) –



SetDataViewColumn(self, col)

For wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.

Parameters

col (wx.dataview.DataViewColumn) –



SetDragFlags(self, flags)

Specify the kind of the drag operation to perform.

This method can be used inside a wxEVT_DATAVIEW_ITEM_BEGIN_DRAG handler in order to configure the drag operation. Valid values are wx.Drag_CopyOnly (default), wx.Drag_AllowMove (allow the data to be moved) and wx.Drag_DefaultMove .

Currently it is only honoured by the generic version of wx.dataview.DataViewCtrl (used e.g. under MSW) and not supported by the native GTK and macOS versions.

Parameters

flags (int) –

New in version 2.9.4.

See also

GetDropEffect



SetDropEffect(self, effect)
Parameters

effect (DragResult) –



SetItem(self, item)
Parameters

item (wx.dataview.DataViewItem) –



SetModel(self, model)

Sets the dataview model associated with this event.

Parameters

model (wx.dataview.DataViewModel) –



SetPosition(self, x, y)
Parameters
  • x (int) –

  • y (int) –



SetValue(self, value)

Sets the value associated with this event.

Parameters

value (DVCVariant) –


Properties

CacheFrom

See GetCacheFrom



CacheTo

See GetCacheTo



Column

See GetColumn and SetColumn



DataBuffer

See GetDataBuffer and SetDataBuffer



DataFormat

See GetDataFormat and SetDataFormat



DataObject

See GetDataObject and SetDataObject



DataSize

See GetDataSize and SetDataSize



DataViewColumn

See GetDataViewColumn and SetDataViewColumn



DragFlags

See GetDragFlags and SetDragFlags



DropEffect

See GetDropEffect and SetDropEffect



Item

See GetItem and SetItem



Model

See GetModel and SetModel



Position

See GetPosition and SetPosition



ProposedDropIndex

See GetProposedDropIndex



Value

See GetValue and SetValue