Class: Wx::GRID::GridCellEditor

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/grid/grid_cell_editor.rb

Overview

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

Instances of GridCellEditor (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. Normally GridCellEditor shows some UI control allowing the user to edit the cell, but starting with wxWidgets 3.1.4 it’s also possible to define “activatable” cell editors, that change the value of the cell directly when it’s activated (typically by pressing Space key or clicking on it), see #try_activate method. Note that when implementing an editor which is always activatable, i.e. never shows any in-place editor, it is more convenient to derive its class from GridCellActivatableEditor than from GridCellEditor itself.

Category: Grid Related Classes

Instance Method Summary collapse

Constructor Details

#initializeWx::GRID::GridCellEditor

Default constructor.



32
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 32

def initialize; end

Instance Method Details

#apply_edit(row, col, grid) ⇒ void

This method returns an undefined value.

Effectively save the changes in the grid.

This function should save the value of the control in the grid. It is called only after #end_edit returns true.

Parameters:



84
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 84

def apply_edit(row, col, grid) end

#begin_edit(row, col, grid) ⇒ void

This method returns an undefined value.

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.

Parameters:

See Also:



42
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 42

def begin_edit(row, col, grid) end

#cloneWx::GRID::GridCellEditor

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



46
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 46

def clone; end

#create(parent, id, evtHandler) ⇒ void

This method returns an undefined value.

Creates the actual edit control.

Parameters:



53
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 53

def create(parent, id, evtHandler) end

#destroyvoid

This method returns an undefined value.

Final cleanup.



57
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 57

def destroy; end

#do_activate(row, col, grid) ⇒ void

This method returns an undefined value.

Function which must be overridden for “activatable” editors.

If #try_activate is overridden to return “change” action, this function will be called to actually apply this change. Note that it is not passed the value to apply, as it is assumed that the editor class stores this value as a member variable anyhow.

Parameters:



187
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 187

def do_activate(row, col, grid) end

#end_edit(row, col, grid, oldval, newval) ⇒ Boolean

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 #begin_edit). If it isn’t, it just returns false, otherwise it must do the following:

  • Save the new value internally so that #apply_edit 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 EVT_GRID_CELL_CHANGING event handler doesn’t veto this change, #apply_edit will be called next.

Parameters:

  • row (Integer)
  • col (Integer)
  • grid (Wx::GRID::Grid)
  • oldval (String)
  • newval (String)

Returns:

  • (Boolean)


75
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 75

def end_edit(row, col, grid, oldval, newval) end

#get_controlWx::Control Also known as: control

Get the Control used by this editor.

This function is preserved for compatibility, but #get_window should be preferred in the new code as the associated window doesn’t need to be of a Control-derived class. Note that if #set_window had been called with an object not deriving from Control, this method will return NULL.

Returns:



157
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 157

def get_control; end

#get_valueString Also known as: value

Returns the value currently in the editor control.

Returns:

  • (String)


138
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 138

def get_value; end

#get_windowWx::Window Also known as: window

Get the edit window used by this editor.

Returns:



143
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 143

def get_window; end

#handle_return(event) ⇒ void

This method returns an undefined value.

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

Parameters:



89
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 89

def handle_return(event) end

#is_accepted_key(event) ⇒ Boolean Also known as: accepted_key?

Return true to allow the given key to start editing: the base class version only checks that the event has no modifiers.

If the key is F2 (special), editing will always start and this method will not be called at all (but #starting_key will)

Parameters:

Returns:

  • (Boolean)


133
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 133

def is_accepted_key(event) end

#is_createdBoolean Also known as: created?

Returns true if the edit control has been created.

Returns:

  • (Boolean)


93
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 93

def is_created; end

#paint_background(dc, rectCell, attr) ⇒ void

This method returns an undefined value.

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

Parameters:



101
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 101

def paint_background(dc, rectCell, attr) end

#resetvoid

This method returns an undefined value.

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



105
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 105

def reset; end

#set_control(control) ⇒ void Also known as: control=

This method returns an undefined value.

Set the Control that will be used by this cell editor for editing the value.

This function is preserved for compatibility, but #set_window should be preferred in the new code, see #get_control.

Parameters:



165
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 165

def set_control(control) end

#set_size(rect) ⇒ void Also known as: size=

This method returns an undefined value.

Size and position the edit control.

Parameters:



110
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 110

def set_size(rect) end

#set_window(window) ⇒ void Also known as: window=

This method returns an undefined value.

Set the Window that will be used by this cell editor for editing the value.

Parameters:



149
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 149

def set_window(window) end

#show(show, attr = nil) ⇒ void

This method returns an undefined value.

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

Parameters:



117
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 117

def show(show, attr=nil) end

#starting_clickvoid

This method returns an undefined value.

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



121
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 121

def starting_click; end

#starting_key(event) ⇒ void

This method returns an undefined value.

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.

Parameters:



126
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 126

def starting_key(event) end

#try_activate(row, col, grid, actSource) ⇒ Wx::GridActivationResult

Function allowing to create an “activatable” editor.

As explained in this class description, activatable editors don’t show any edit control but change the cell value directly, when it is activated (by any way described by Wx::GridActivationSource). To create such editor, this method must be overridden to return Wx::GridActivationResult#do_change passing it the new value of the cell. If the change is not vetoed by EVT_GRID_CELL_CHANGING handler, #do_activate will be called to actually change the value, so it must be overridden as well if #try_activate is overridden. By default, Wx::GridActivationResult#do_edit is returned, meaning that this is a normal editor, using an edit control for changing the cell value.

Parameters:

  • row (Integer)
  • col (Integer)
  • grid (Wx::GRID::Grid)
  • actSource (Wx::GridActivationSource)

Returns:

  • (Wx::GridActivationResult)


178
# File 'lib/wx/doc/gen/grid/grid_cell_editor.rb', line 178

def try_activate(row, col, grid, actSource) end