mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 17:11:12 +02:00
KeyView: fix focus issue
Problem: A user can tab to the list, and none of the items is the focus. The list itself is still the focus. As a result, there is no visual indication of the focus, and an additional keystroke is needed to make any item the focus. Fix: When the list gains focus, if no items are selected, select the first item, if there is one.
This commit is contained in:
@@ -1232,18 +1232,32 @@ KeyView::OnSetFocus(wxFocusEvent & event)
|
||||
// Allow further processing
|
||||
event.Skip();
|
||||
|
||||
// Refresh the selected line to pull in any changes while
|
||||
// focus was away...like when setting a NEW key value. This
|
||||
// will also refresh the visual (highlighted) state.
|
||||
if (GetSelection() != wxNOT_FOUND)
|
||||
{
|
||||
// Refresh the selected line to pull in any changes while
|
||||
// focus was away...like when setting a NEW key value. This
|
||||
// will also refresh the visual (highlighted) state.
|
||||
RefreshRow(GetSelection());
|
||||
}
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
// Tell accessibility of the change
|
||||
mAx->SetCurrentLine(GetSelection());
|
||||
// Tell accessibility of the change
|
||||
mAx->SetCurrentLine(GetSelection());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mLines.size() > 0)
|
||||
{
|
||||
// if no selection, select first line, if there is one
|
||||
SelectNode(LineToIndex(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
// Tell accessibility, since there may have been a change
|
||||
mAx->SetCurrentLine(wxNOT_FOUND);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user