Really fix the problem with caret in wxGrid text editor under MSW.

The problem (see #11681) was due to not allowing the native control handle the
focus loss event. This, in turn, was due to the changes of r58969 which tried
to work around a crash which happened if the grid was destroyed from the code
of one of the user-defined event handlers called during the editor dismissal.

Fix both problems at once by calling event.Skip() in OnKillFocus() to let the
native handler have the event too and postponing the editor dismissal a little
by calling DisableCellEditControl() indirectly from a posted event handler
instead of immediately.

As this reverts the now unnecessary changes of r64646, it closes #15162.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-04-28 18:25:42 +00:00
parent 5959d184d0
commit add6e9193d
4 changed files with 28 additions and 15 deletions

View File

@@ -2159,6 +2159,7 @@ BEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow )
EVT_KEY_UP( wxGrid::OnKeyUp )
EVT_CHAR ( wxGrid::OnChar )
EVT_ERASE_BACKGROUND( wxGrid::OnEraseBackground )
EVT_COMMAND(wxID_ANY, wxEVT_GRID_HIDE_EDITOR, wxGrid::OnHideEditor )
END_EVENT_TABLE()
bool wxGrid::Create(wxWindow *parent, wxWindowID id,
@@ -6553,6 +6554,11 @@ void wxGrid::SaveEditControlValue()
}
}
void wxGrid::OnHideEditor(wxCommandEvent& WXUNUSED(event))
{
DisableCellEditControl();
}
//
// ------ Grid location functions
// Note that all of these functions work with the logical coordinates of