KiCad PCB EDA Suite
GRID_CELL_TEXT_EDITOR Class Reference

This class works around a bug in wxGrid where the first keystroke doesn't get sent through the validator if the editor wasn't already open. More...

#include <validators.h>

Inheritance diagram for GRID_CELL_TEXT_EDITOR:

Public Member Functions

 GRID_CELL_TEXT_EDITOR ()
 
virtual void SetValidator (const wxValidator &validator) override
 
virtual void StartingKey (wxKeyEvent &event) override
 

Protected Attributes

wxScopedPtr< wxValidator > m_validator
 

Detailed Description

This class works around a bug in wxGrid where the first keystroke doesn't get sent through the validator if the editor wasn't already open.

Definition at line 44 of file validators.h.

Constructor & Destructor Documentation

◆ GRID_CELL_TEXT_EDITOR()

GRID_CELL_TEXT_EDITOR::GRID_CELL_TEXT_EDITOR ( )

Definition at line 41 of file validators.cpp.

41 : wxGridCellTextEditor()
42{
43}

Member Function Documentation

◆ SetValidator()

void GRID_CELL_TEXT_EDITOR::SetValidator ( const wxValidator &  validator)
overridevirtual

Definition at line 46 of file validators.cpp.

47{
48 // keep our own copy because wxGridCellTextEditor's is annoyingly private
49 m_validator.reset( static_cast<wxValidator*>( validator.Clone() ) );
50
51 wxGridCellTextEditor::SetValidator( *m_validator );
52}
wxScopedPtr< wxValidator > m_validator
Definition: validators.h:53

References m_validator.

Referenced by FIELDS_GRID_TABLE< T >::initGrid().

◆ StartingKey()

void GRID_CELL_TEXT_EDITOR::StartingKey ( wxKeyEvent &  event)
overridevirtual

Definition at line 55 of file validators.cpp.

56{
57 if( m_validator )
58 {
59 m_validator.get()->SetWindow( Text() );
60 m_validator.get()->ProcessEvent( event );
61 }
62
63 if( event.GetSkipped() )
64 {
65 wxGridCellTextEditor::StartingKey( event );
66 event.Skip( false );
67 }
68}

References m_validator.

Member Data Documentation

◆ m_validator

wxScopedPtr<wxValidator> GRID_CELL_TEXT_EDITOR::m_validator
protected

Definition at line 53 of file validators.h.

Referenced by SetValidator(), and StartingKey().


The documentation for this class was generated from the following files: