KiCad PCB EDA Suite
GRID_CELL_TEXT_EDITOR Class Reference

Class GRID_CELL_TEXT_EDITOR. 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

Class GRID_CELL_TEXT_EDITOR.

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 42 of file validators.h.

Constructor & Destructor Documentation

GRID_CELL_TEXT_EDITOR::GRID_CELL_TEXT_EDITOR ( )

Definition at line 39 of file validators.cpp.

39  : wxGridCellTextEditor()
40 {
41 }

Member Function Documentation

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

Definition at line 44 of file validators.cpp.

References m_validator.

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

45 {
46  // keep our own copy because wxGridCellTextEditor's is annoyingly private
47  m_validator.reset( static_cast<wxValidator*>( validator.Clone() ) );
48 
49  wxGridCellTextEditor::SetValidator( *m_validator );
50 }
wxScopedPtr< wxValidator > m_validator
Definition: validators.h:51
void GRID_CELL_TEXT_EDITOR::StartingKey ( wxKeyEvent &  event)
overridevirtual

Definition at line 53 of file validators.cpp.

References m_validator.

54 {
55  if( m_validator )
56  {
57  m_validator.get()->SetWindow( Text() );
58  m_validator.get()->ProcessEvent( event );
59  }
60 
61  if( event.GetSkipped() )
62  {
63  wxGridCellTextEditor::StartingKey( event );
64  event.Skip( false );
65  }
66 }
wxScopedPtr< wxValidator > m_validator
Definition: validators.h:51

Member Data Documentation

wxScopedPtr<wxValidator> GRID_CELL_TEXT_EDITOR::m_validator
protected

Definition at line 51 of file validators.h.

Referenced by SetValidator(), and StartingKey().


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