1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 00:19:27 +02:00

TrackPanel: fix when it is set as keyboard handler.

Problem:
Currently KeyboardCapture::Capture(this) is called in TrackPanel::OnTrackFocusChange().
So the keyboard handler is not automatically set when the track panel becomes the focus.
Example of a symptom:
A project contains a label track, and is the focus, and type to create a label is enabled.
Move to focus to another window, and then back to the Audacity window.
Type a character. A label is not created.

Fix:
Move the call KeyboardCapture::Capture(this) to TrackPanel::SetFocusedCell(), so that it gets called when the TrackPanel becomes the focus.
This commit is contained in:
David Bailes 2019-07-05 15:18:16 +01:00
parent f327fef80b
commit dc88fe84d9

View File

@ -1323,6 +1323,7 @@ void TrackPanel::SetFocusedCell()
{
// This may have a side-effet of assigning a focus if there was none
TrackFocus::Get( *GetProject() ).Get();
KeyboardCapture::Capture(this);
}
void TrackPanel::OnTrackFocusChange( wxCommandEvent &event )
@ -1331,7 +1332,6 @@ void TrackPanel::OnTrackFocusChange( wxCommandEvent &event )
auto cell = GetFocusedCell();
if (cell) {
KeyboardCapture::Capture(this);
Refresh( false );
}
}