Dialog: Esc key closes a grid editor first.
CHANGED: By default dialog closes on Esc key immediately and if dialog has a grid control there is no way to close a cell editor with canceling changes. New behavior is next: if dialog has a grid and the grid has an active cell editor Esc key closes cell editor, otherwise Esc key closes the dialog.
This commit is contained in:
parent
98a911dcb4
commit
65f5bd6a01
|
@ -28,6 +28,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <eda_rect.h>
|
||||
#include <wx/display.h>
|
||||
#include <wx/grid.h>
|
||||
|
||||
/// Toggle a window's "enable" status to disabled, then enabled on destruction.
|
||||
class WDO_ENABLE_DISABLE
|
||||
|
@ -54,6 +55,14 @@ public:
|
|||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
|
||||
// If dialog has a grid and the grid has an active cell editor
|
||||
// Esc key closes cell editor, otherwise Esc key closes the dialog.
|
||||
EVT_GRID_EDITOR_SHOWN( DIALOG_SHIM::OnGridEditorShown )
|
||||
EVT_GRID_EDITOR_HIDDEN( DIALOG_SHIM::OnGridEditorHidden )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name ) :
|
||||
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
|
@ -461,3 +470,17 @@ void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
|
|||
// This is mandatory to allow wxDialogBase::OnButton() to be called.
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SHIM::OnGridEditorShown( wxGridEvent& event )
|
||||
{
|
||||
SetEscapeId( wxID_NONE );
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SHIM::OnGridEditorHidden( wxGridEvent& event )
|
||||
{
|
||||
SetEscapeId( wxID_ANY );
|
||||
event.Skip();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <wx/dialog.h>
|
||||
#include <hashtables.h>
|
||||
#include <kiway_player.h>
|
||||
class wxGridEvent;
|
||||
|
||||
|
||||
|
||||
|
@ -182,6 +183,12 @@ protected:
|
|||
WX_EVENT_LOOP* m_qmodal_loop; // points to nested event_loop, NULL means not qmodal and dismissed
|
||||
bool m_qmodal_showing;
|
||||
WDO_ENABLE_DISABLE* m_qmodal_parent_disabler;
|
||||
|
||||
private:
|
||||
void OnGridEditorShown( wxGridEvent& event );
|
||||
void OnGridEditorHidden( wxGridEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // DIALOG_SHIM_
|
||||
|
|
Loading…
Reference in New Issue