Public Member Functions | Protected Member Functions

# wxGridCellEditor Class Reference
[Grid Related Classes]

`#include <wx/grid.h>`

Inheritance diagram for wxGridCellEditor:
[legend]

## Detailed Description

This class is responsible for providing and manipulating the in-place edit controls for the grid.

Instances of wxGridCellEditor (actually, instances of derived classes since it is an abstract class) can be associated with the cell attributes for individual cells, rows, columns, or even for the entire grid.

##

Library: wxAdvanced
Category: Grid Related Classes

See also:
  wxGridCellAutoWrapStringEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor, wxGridCellEnumEditor, wxGridCellFloatEditor, wxGridCellNumberEditor, wxGridCellTextEditor

## Public Member Functions
| wxGridCellEditor ()
| Default constructor.
virtual void | BeginEdit (int row, int col, wxGrid *grid)=0
| Fetch the value from the table and prepare the edit control to begin editing.
virtual wxGridCellEditor * | Clone () const =0
| Create a new object which is the copy of this one.
virtual void | Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)=0
| Creates the actual edit control.
virtual void | Destroy ()
| Final cleanup.
virtual bool | EndEdit (int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval)=0
| End editing the cell.
virtual void | ApplyEdit (int row, int col, wxGrid *grid)=0
| Effectively save the changes in the grid.
virtual void | HandleReturn (wxKeyEvent &event)
| Some types of controls on some platforms may need some help with the Return key.
bool | IsCreated ()
| Returns true if the edit control has been created.
virtual void | PaintBackground (const wxRect &rectCell, wxGridCellAttr *attr)
| Draws the part of the cell not occupied by the control: the base class version just fills it with background colour from the attribute.
virtual void | Reset ()=0
| Reset the value in the control back to its starting value.
virtual void | SetSize (const wxRect &rect)
| Size and position the edit control.
virtual void | Show (bool show, wxGridCellAttr *attr=NULL)
| Show or hide the edit control, use the specified attributes to set colours/fonts for it.
virtual void | StartingClick ()
| If the editor is enabled by clicking on the cell, this method will be called.
virtual void | StartingKey (wxKeyEvent &event)
| If the editor is enabled by pressing keys on the grid, this will be called to let the editor do something about that first key if desired.
## Protected Member Functions
virtual | ~wxGridCellEditor ()
| The destructor is private because only DecRef() can delete us.

List of all members.

## Constructor & Destructor Documentation

wxGridCellEditor::wxGridCellEditor | ( |  | ) |

Default constructor.

virtual wxGridCellEditor::~wxGridCellEditor | ( |  | ) | `[protected, virtual]`

The destructor is private because only DecRef() can delete us.

## Member Function Documentation

virtual void wxGridCellEditor::ApplyEdit | ( | int | row,
|  | int | col,
|  | wxGrid * | grid |
| ) |  |  | `[pure virtual]`

Effectively save the changes in the grid.

This function should save the value of the control in the grid. It is called only after EndEdit() returns true.

virtual void wxGridCellEditor::BeginEdit | ( | int | row,
|  | int | col,
|  | wxGrid * | grid |
| ) |  |  | `[pure virtual]`

Fetch the value from the table and prepare the edit control to begin editing.

This function should save the original value of the grid cell at the given row and col and show the control allowing the user to change it.

See also:
  EndEdit()

virtual wxGridCellEditor* wxGridCellEditor::Clone | ( |  | ) | const`[pure virtual]`

Create a new object which is the copy of this one.

virtual void wxGridCellEditor::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | wxEvtHandler * | evtHandler |
| ) |  |  | `[pure virtual]`

Creates the actual edit control.

virtual void wxGridCellEditor::Destroy | ( |  | ) | `[virtual]`

Final cleanup.

virtual bool wxGridCellEditor::EndEdit | ( | int | row,
|  | int | col,
|  | const wxGrid * | grid,
|  | const wxString & | oldval,
|  | wxString * | newval |
| ) |  |  | `[pure virtual]`

End editing the cell.

This function must check if the current value of the editing control is valid and different from the original value (available as oldval in its string form and possibly saved internally using its real type by BeginEdit()). If it isn't, it just returns false, otherwise it must do the following: # Save the new value internally so that ApplyEdit() could apply it. # Fill newval (which is never NULL) with the string representation of the new value. # Return true

Notice that it must not modify the grid as the change could still be vetoed.

If the user-defined wxEVT_GRID_CELL_CHANGING event handler doesn't veto this change, ApplyEdit() will be called next.

virtual void wxGridCellEditor::HandleReturn | ( | wxKeyEvent & | event | ) | `[virtual]`

Some types of controls on some platforms may need some help with the Return key.

bool wxGridCellEditor::IsCreated | ( |  | ) |

Returns true if the edit control has been created.

virtual void wxGridCellEditor::PaintBackground | ( | const wxRect & | rectCell,
|  | wxGridCellAttr * | attr |
| ) |  |  | `[virtual]`

Draws the part of the cell not occupied by the control: the base class version just fills it with background colour from the attribute.

virtual void wxGridCellEditor::Reset | ( |  | ) | `[pure virtual]`

Reset the value in the control back to its starting value.

virtual void wxGridCellEditor::SetSize | ( | const wxRect & | rect | ) | `[virtual]`

Size and position the edit control.

virtual void wxGridCellEditor::Show | ( | bool | show,
|  | wxGridCellAttr * | attr = `NULL` |
| ) |  |  | `[virtual]`

Show or hide the edit control, use the specified attributes to set colours/fonts for it.

virtual void wxGridCellEditor::StartingClick | ( |  | ) | `[virtual]`

If the editor is enabled by clicking on the cell, this method will be called.

virtual void wxGridCellEditor::StartingKey | ( | wxKeyEvent & | event | ) | `[virtual]`

If the editor is enabled by pressing keys on the grid, this will be called to let the editor do something about that first key if desired.

|  | [ top ]