.. include:: headings.inc .. currentmodule:: lib.sheet .. highlight:: python .. _lib.sheet.CCellEditor: ========================================================================================================================================== |phoenix_title| **CCellEditor** ========================================================================================================================================== Custom cell editor | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **CCellEditor** .. raw:: html

Inheritance diagram of CCellEditor

| |super_classes| Known Superclasses ================================== :class:`grid.PyGridCellEditor` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~lib.sheet.CCellEditor.__init__` :meth:`~lib.sheet.CCellEditor.BeginEdit` Fetch the value from the table and prepare edit control to begin editing. :meth:`~lib.sheet.CCellEditor.Clone` Create a new object which is the copy of this one. Must Override. :meth:`~lib.sheet.CCellEditor.Create` Create the actual edit control. Must derive from wxControl. :meth:`~lib.sheet.CCellEditor.Destroy` Final cleanup :meth:`~lib.sheet.CCellEditor.EndEdit` Commit editing the current cell. Returns ``True`` if the value has changed. :meth:`~lib.sheet.CCellEditor.IsAcceptedKey` Return ``True`` to allow the given key to start editing. The base class :meth:`~lib.sheet.CCellEditor.PaintBackground` Draws the part of the cell not occupied by the edit control. The :meth:`~lib.sheet.CCellEditor.Reset` Reset the value in the control back to its starting value. Must Override. :meth:`~lib.sheet.CCellEditor.SetSize` Position/size the edit control within the cell rectangle. :meth:`~lib.sheet.CCellEditor.Show` Show or hide the edit control. Use the attr (if not None) :meth:`~lib.sheet.CCellEditor.StartingClick` If the editor is enabled by clicking on the cell, this method will be :meth:`~lib.sheet.CCellEditor.StartingKey` If the editor is enabled by pressing keys on the grid, this will be ================================================================================ ================================================================================ | |api| Class API =============== .. class:: CCellEditor(grid.PyGridCellEditor) Custom cell editor .. method:: __init__(self, grid) .. method:: BeginEdit(self, row, col, grid) Fetch the value from the table and prepare edit control to begin editing. Set the focus to the edit control. Must Override. .. method:: Clone(self) Create a new object which is the copy of this one. Must Override. .. method:: Create(self, parent, id, evtHandler) Create the actual edit control. Must derive from wxControl. Must Override .. method:: Destroy(self) Final cleanup NOTE: There is no need to everride this if you don't need to do something out of the ordinary. .. method:: EndEdit(self, row, col, grid) Commit editing the current cell. Returns ``True`` if the value has changed. If necessary, the control may be destroyed. Must Override. .. method:: IsAcceptedKey(self, evt) Return ``True`` to allow the given key to start editing. The base class version only checks that the event has no modifiers. F2 is special and will always start the editor. .. method:: PaintBackground(self, rect, attr) Draws the part of the cell not occupied by the edit control. The base class version just fills it with background colour from the attribute. NOTE: There is no need to everride this if you don't need to do something out of the ordinary. .. method:: Reset(self) Reset the value in the control back to its starting value. Must Override. .. method:: SetSize(self, rect) Position/size the edit control within the cell rectangle. .. method:: Show(self, show, attr) Show or hide the edit control. Use the attr (if not None) to set colors or fonts for the control. NOTE: There is no need to everride this if you don't need to do something out of the ordinary. .. method:: StartingClick(self) If the editor is enabled by clicking on the cell, this method will be called to allow the editor to simulate the click on the control. .. method:: StartingKey(self, evt) If the editor is enabled by pressing keys on the grid, this will be called to let the editor react to that first key.