Closed MaartenBent closed 9 years ago
Thanks for reporting this. This feature is new and still under improvements. If you find something else with it, please let me know
You should probably use event.GetUnicodeKey()
instead of event.GetKeyCode()
, as wxWidgets suggests. Also the first character is capitalized while shift
is being disabled.. If shift
is not used as an accelerator for some functions, you could allow it like:
if ((event.GetModifiers() != wxMOD_NONE && event.GetModifiers() != wxMOD_SHIFT) || ignoreKeys.count(ch)) {
event.Skip();
return;
}
if (!m_text->IsShown()) {
DoShowTextBox();
}
wxString chStr(event.GetUnicodeKey());
if (!event.ShiftDown())
chStr.MakeLower();
m_text->ChangeValue(chStr);
One last suggestion. You could also use the following instead of using the ignore list:
wxChar ch = event.GetUnicodeKey();
if((event.GetModifiers() != wxMOD_NONE && event.GetModifiers() != wxMOD_SHIFT) || ch == WXK_NONE) {
event.Skip();
return;
}
if(!m_text->IsShown()) {
DoShowTextBox();
}
wxString chStr(ch);
(Only shortly tested)
This does not work for all keyboard keys (e.g. ESCAPE, BACKSPACE)
Almost all keys on the keyboard trigger the search function (numpad keys; ins, del home, etc; capslock, scroll lock).
These keys should probably be excluded. Numpad could be useful but currently it generates strange characters.