From ffbcbd78b17009df874649d310a54d2b4a4786ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 3 Oct 2022 20:02:58 +0200 Subject: [PATCH] Show details of key events in the control in dataview sample This is just to make it more obvious that we get these events. See #15377. --- samples/dataview/dataview.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index a4870707c2..1b99513d6f 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -1767,6 +1767,19 @@ void MyFrame::OnSorted( wxDataViewEvent &event ) void MyFrame::OnDataViewChar(wxKeyEvent& event) { + wxString key; +#if wxUSE_UNICODE + if ( event.GetUnicodeKey() != WXK_NONE ) + key.Printf("\"%c\"", event.GetUnicodeKey()); + else +#endif + if ( event.GetKeyCode() != WXK_NONE ) + key.Printf("wxKeyCode(%d)", event.GetKeyCode()); + else + key = "unknown key"; + + wxLogMessage("wxEVT_CHAR for %s", key); + if ( event.GetKeyCode() == WXK_DELETE ) DeleteSelectedItems(); else