# wxListEvent Class Reference
[Events]

`#include <wx/listctrl.h>`

Inheritance diagram for wxListEvent:
[legend]

## Detailed Description

A list event holds information about events associated with wxListCtrl objects.

## Events using this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxListEvent& event)
Event macros:

- EVT_LIST_BEGIN_DRAG(id, func):
  Begin dragging with the left mouse button.
- EVT_LIST_BEGIN_RDRAG(id, func):
  Begin dragging with the right mouse button.
- EVT_LIST_BEGIN_LABEL_EDIT(id, func):
  Begin editing a label. This can be prevented by calling Veto().
- EVT_LIST_END_LABEL_EDIT(id, func):
  Finish editing a label. This can be prevented by calling Veto().
- EVT_LIST_DELETE_ITEM(id, func):
  Delete an item.
- EVT_LIST_DELETE_ALL_ITEMS(id, func):
  Delete all items.
- EVT_LIST_ITEM_SELECTED(id, func):
  The item has been selected.
- EVT_LIST_ITEM_DESELECTED(id, func):
  The item has been deselected.
- EVT_LIST_ITEM_ACTIVATED(id, func):
  The item has been activated (ENTER or double click).
- EVT_LIST_ITEM_FOCUSED(id, func):
  The currently focused item has changed.
- EVT_LIST_ITEM_MIDDLE_CLICK(id, func):
  The middle mouse button has been clicked on an item.
- EVT_LIST_ITEM_RIGHT_CLICK(id, func):
  The right mouse button has been clicked on an item.
- EVT_LIST_KEY_DOWN(id, func):
  A key has been pressed. GetIndex() may be -1 if no item is selected.
- EVT_LIST_INSERT_ITEM(id, func):
  An item has been inserted.
- EVT_LIST_COL_CLICK(id, func):
  A column (m_col) has been left-clicked.
- EVT_LIST_COL_RIGHT_CLICK(id, func):
  A column (m_col) (which can be -1 if the click occurred outside any column) has been right-clicked.
- EVT_LIST_COL_BEGIN_DRAG(id, func):
  The user started resizing a column - can be vetoed.
- EVT_LIST_COL_DRAGGING(id, func):
  The divider between columns is being dragged.
- EVT_LIST_COL_END_DRAG(id, func):
  A column has been resized by the user.
- EVT_LIST_CACHE_HINT(id, func):
  Prepare cache for a virtual list control

##

Library: wxBase

Category: Events

See also:
  wxListCtrl

## Public Member Functions
| wxListEvent (wxEventType commandType=wxEVT_NULL, int id=0)
| Constructor.
long | GetCacheFrom () const
| For `EVT_LIST_CACHE_HINT` event only: return the first item which the list control advises us to cache.
long | GetCacheTo () const
| For `EVT_LIST_CACHE_HINT` event only: return the last item (inclusive) which the list control advises us to cache.
int | GetColumn () const
| The column position: it is only used with `COL` events.
long | GetData () const
| The data.
int | GetImage () const
| The image.
long | GetIndex () const
| The item index.
const wxListItem & | GetItem () const
| An item object, used by some events.
int | GetKeyCode () const
| Key code if the event is a keypress event.
const wxString & | GetLabel () const
| The (new) item label for `EVT_LIST_END_LABEL_EDIT` event.
long | GetMask () const
| The mask.
wxPoint | GetPoint () const
| The position of the mouse pointer if the event is a drag event.
const wxString & | GetText () const
| The text.
bool | IsEditCancelled () const
| This method only makes sense for `EVT_LIST_END_LABEL_EDIT` message and returns true if it the label editing has been cancelled by the user (GetLabel() returns an empty string in this case but it doesn't allow the application to distinguish between really cancelling the edit and the admittedly rare case when the user wants to rename it to an empty string).

List of all members.

## Constructor & Destructor Documentation

wxListEvent::wxListEvent | ( | wxEventType | commandType = `wxEVT_NULL`,
|  | int | id = `0` |
| ) |  |  |

Constructor.

## Member Function Documentation

long wxListEvent::GetCacheFrom | ( |  | ) | const

For `EVT_LIST_CACHE_HINT` event only: return the first item which the list control advises us to cache.

long wxListEvent::GetCacheTo | ( |  | ) | const

For `EVT_LIST_CACHE_HINT` event only: return the last item (inclusive) which the list control advises us to cache.

int wxListEvent::GetColumn | ( |  | ) | const

The column position: it is only used with `COL` events.

For the column dragging events, it is the column to the left of the divider being dragged, for the column click events it may be -1 if the user clicked in the list control header outside any column.

long wxListEvent::GetData | ( |  | ) | const

The data.

int wxListEvent::GetImage | ( |  | ) | const

The image.

long wxListEvent::GetIndex | ( |  | ) | const

The item index.

const wxListItem& wxListEvent::GetItem | ( |  | ) | const

An item object, used by some events.

See also wxListCtrl::SetItem.

int wxListEvent::GetKeyCode | ( |  | ) | const

Key code if the event is a keypress event.

const wxString& wxListEvent::GetLabel | ( |  | ) | const

The (new) item label for `EVT_LIST_END_LABEL_EDIT` event.

long wxListEvent::GetMask | ( |  | ) | const

The mask.

wxPoint wxListEvent::GetPoint | ( |  | ) | const

The position of the mouse pointer if the event is a drag event.

const wxString& wxListEvent::GetText | ( |  | ) | const

The text.

bool wxListEvent::IsEditCancelled | ( |  | ) | const

This method only makes sense for `EVT_LIST_END_LABEL_EDIT` message and returns true if it the label editing has been cancelled by the user (GetLabel() returns an empty string in this case but it doesn't allow the application to distinguish between really cancelling the edit and the admittedly rare case when the user wants to rename it to an empty string).

|  | [ top ]