Phoenix Logo

phoenix_title wx.grid.GridEvent

This event class contains information about various grid events.

Notice that all grid event table macros are available in two versions: EVT_GRID_XXX and EVT_GRID_CMD_XXX . The only difference between the two is that the former doesn’t allow to specify the grid window identifier and so takes a single parameter, the event handler, but is not suitable if there is more than one grid control in the window where the event table is used (as it would catch the events from all the grids). The version with CMD takes the id as first argument and the event handler as the second one and so can be used with multiple grids as well. Otherwise there are no difference between the two and only the versions without the id are documented below for brevity.

events Events Emitted by this Class

Handlers bound for the following event types will receive a wx.grid.GridEvent parameter.

  • EVT_GRID_CELL_CHANGING: The user is about to change the data in a cell. The new cell value as string is available from GetString event object method. This event can be vetoed if the change is not allowed. Processes a wxEVT_GRID_CELL_CHANGING event type.
  • EVT_GRID_CELL_CHANGED: The user changed the data in a cell. The old cell value as string is available from GetString event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.
  • EVT_GRID_CELL_LEFT_CLICK: The user clicked a cell with the left mouse button. Processes a wxEVT_GRID_CELL_LEFT_CLICK event type.
  • EVT_GRID_CELL_LEFT_DCLICK: The user double-clicked a cell with the left mouse button. Processes a wxEVT_GRID_CELL_LEFT_DCLICK event type.
  • EVT_GRID_CELL_RIGHT_CLICK: The user clicked a cell with the right mouse button. Processes a wxEVT_GRID_CELL_RIGHT_CLICK event type.
  • EVT_GRID_CELL_RIGHT_DCLICK: The user double-clicked a cell with the right mouse button. Processes a wxEVT_GRID_CELL_RIGHT_DCLICK event type.
  • EVT_GRID_EDITOR_HIDDEN: The editor for a cell was hidden. Processes a wxEVT_GRID_EDITOR_HIDDEN event type.
  • EVT_GRID_EDITOR_SHOWN: The editor for a cell was shown. Processes a wxEVT_GRID_EDITOR_SHOWN event type.
  • EVT_GRID_LABEL_LEFT_CLICK: The user clicked a label with the left mouse button. Processes a wxEVT_GRID_LABEL_LEFT_CLICK event type.
  • EVT_GRID_LABEL_LEFT_DCLICK: The user double-clicked a label with the left mouse button. Processes a wxEVT_GRID_LABEL_LEFT_DCLICK event type.
  • EVT_GRID_LABEL_RIGHT_CLICK: The user clicked a label with the right mouse button. Processes a wxEVT_GRID_LABEL_RIGHT_CLICK event type.
  • EVT_GRID_LABEL_RIGHT_DCLICK: The user double-clicked a label with the right mouse button. Processes a wxEVT_GRID_LABEL_RIGHT_DCLICK event type.
  • EVT_GRID_SELECT_CELL: The given cell was made current, either by user or by the program via a call to SetGridCursor() or GoToCell(). Processes a wxEVT_GRID_SELECT_CELL event type.
  • EVT_GRID_COL_MOVE: The user tries to change the order of the columns in the grid by dragging the column specified by GetCol. This event can be vetoed to either prevent the user from reordering the column change completely (but notice that if you don’t want to allow it at all, you simply shouldn’t call wx.grid.Grid.EnableDragColMove in the first place), vetoed but handled in some way in the handler, e.g. by really moving the column to the new position at the associated table level, or allowed to proceed in which case wx.grid.Grid.SetColPos is used to reorder the columns display order without affecting the use of the column indices otherwise. This event macro corresponds to wxEVT_GRID_COL_MOVE event type.
  • EVT_GRID_COL_SORT: This event is generated when a column is clicked by the user and its name is explained by the fact that the custom reaction to a click on a column is to sort the grid contents by this column. However the grid itself has no special support for sorting and it’s up to the handler of this event to update the associated table. But if the event is handled (and not vetoed) the grid supposes that the table was indeed resorted and updates the column to indicate the new sort order and refreshes itself. This event macro corresponds to wxEVT_GRID_COL_SORT event type.
  • EVT_GRID_TABBING: This event is generated when the user presses TAB or Shift-TAB in the grid. It can be used to customize the simple default TAB handling logic, e.g. to go to the next non-empty cell instead of just the next cell. See also wx.grid.Grid.SetTabBehaviour . This event is new since wxWidgets 2.9.5.

class_hierarchy Class Hierarchy

Inheritance diagram for class GridEvent:

method_summary Methods Summary

__init__ Default constructor.
AltDown Returns True if the Alt key was down at the time of the event.
ControlDown Returns True if the Control key was down at the time of the event.
GetCol Column at which the event occurred.
GetPosition Position in pixels at which the event occurred.
GetRow Row at which the event occurred.
MetaDown Returns True if the Meta key was down at the time of the event.
Selecting Returns True if the user is selecting grid cells, or False if deselecting.
ShiftDown Returns True if the Shift key was down at the time of the event.

property_summary Properties Summary

Col See GetCol
Position See GetPosition
Row See GetRow

api Class API



class wx.grid.GridEvent(NotifyEvent)

Possible constructors:

GridEvent()

GridEvent(id, type, obj, row=-1, col=-1, x=-1, y=-1, sel=True,
          kbd=KeyboardState())

This event class contains information about various grid events.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, id, type, obj, row=-1, col=-1, x=-1, y=-1, sel=True, kbd=KeyboardState())

Constructor for initializing all event attributes.

Parameters:
  • id (int) –
  • type (wx.EventType) –
  • obj (wx.Object) –
  • row (int) –
  • col (int) –
  • x (int) –
  • y (int) –
  • sel (bool) –
  • kbd (wx.KeyboardState) –





AltDown(self)

Returns True if the Alt key was down at the time of the event.

Return type:bool


ControlDown(self)

Returns True if the Control key was down at the time of the event.

Return type:bool


GetCol(self)

Column at which the event occurred.

Notice that for a wxEVT_GRID_SELECT_CELL event this column is the column of the newly selected cell while the previously selected cell can be retrieved using wx.grid.Grid.GetGridCursorCol .

Return type:int


GetPosition(self)

Position in pixels at which the event occurred.

Return type:Point


GetRow(self)

Row at which the event occurred.

Notice that for a wxEVT_GRID_SELECT_CELL event this row is the row of the newly selected cell while the previously selected cell can be retrieved using wx.grid.Grid.GetGridCursorRow .

Return type:int


MetaDown(self)

Returns True if the Meta key was down at the time of the event.

Return type:bool


Selecting(self)

Returns True if the user is selecting grid cells, or False if deselecting.

Return type:bool


ShiftDown(self)

Returns True if the Shift key was down at the time of the event.

Return type:bool

Properties



Col

See GetCol



Position

See GetPosition



Row

See GetRow