mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-24 16:20:05 +02:00
Bug682: fix Tab key navigation in Preferences, particulary Keyboard
This commit is contained in:
parent
4739f3e27b
commit
9f6eedf6e4
@ -73,6 +73,9 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
|
|||||||
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
|
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
|
||||||
EVT_BUTTON(wxID_APPLY, PrefsDialog::OnApply)
|
EVT_BUTTON(wxID_APPLY, PrefsDialog::OnApply)
|
||||||
EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
|
EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
|
||||||
|
|
||||||
|
EVT_CHAR_HOOK(PrefsDialog::OnCharHook)
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@ -373,6 +376,12 @@ void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
|
|||||||
event.Skip(); // Ensure standard behavior when enter is not pressed
|
event.Skip(); // Ensure standard behavior when enter is not pressed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrefsDialog::OnCharHook(wxKeyEvent &event)
|
||||||
|
{
|
||||||
|
// Common behavior, let's define it in just one place
|
||||||
|
wxPanelWrapper::DoCharHook(event);
|
||||||
|
}
|
||||||
|
|
||||||
void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
RecordExpansionState();
|
RecordExpansionState();
|
||||||
|
@ -61,6 +61,8 @@ class PrefsDialog /* not final */ : public wxDialog
|
|||||||
void OnApply(wxCommandEvent & e);
|
void OnApply(wxCommandEvent & e);
|
||||||
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
|
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
|
||||||
|
|
||||||
|
void OnCharHook(wxKeyEvent &e);
|
||||||
|
|
||||||
void SelectPageByName(const wxString &pageName);
|
void SelectPageByName(const wxString &pageName);
|
||||||
|
|
||||||
// Accessor to help implementations of SavePreferredPage(),
|
// Accessor to help implementations of SavePreferredPage(),
|
||||||
|
@ -18,7 +18,7 @@ wxPanelWrapper::wxPanelWrapper(wxWindow * parent, wxWindowID id,
|
|||||||
: wxPanel(parent, id, pos, size, style)
|
: wxPanel(parent, id, pos, size, style)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void wxPanelWrapper::OnCharHook(wxKeyEvent &event)
|
void wxPanelWrapper::DoCharHook(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
if (event.GetKeyCode() == WXK_TAB) {
|
if (event.GetKeyCode() == WXK_TAB) {
|
||||||
wxWindow::FindFocus()->Navigate(
|
wxWindow::FindFocus()->Navigate(
|
||||||
@ -32,6 +32,11 @@ void wxPanelWrapper::OnCharHook(wxKeyEvent &event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPanelWrapper::OnCharHook(wxKeyEvent &event)
|
||||||
|
{
|
||||||
|
DoCharHook(event);
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPanelWrapper, wxPanel)
|
BEGIN_EVENT_TABLE(wxPanelWrapper, wxPanel)
|
||||||
EVT_CHAR_HOOK(wxPanelWrapper::OnCharHook)
|
EVT_CHAR_HOOK(wxPanelWrapper::OnCharHook)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
@ -21,6 +21,8 @@ public:
|
|||||||
// default as for wxPanel:
|
// default as for wxPanel:
|
||||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER);
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER);
|
||||||
|
|
||||||
|
static void DoCharHook(wxKeyEvent &event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnCharHook(wxKeyEvent &event);
|
void OnCharHook(wxKeyEvent &event);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user