Commit 7500f36

Nick Faro committed on
fix focus issue
commit 7500f36d2145b1293c67e06975be38d8f1d41894 parent fad0b1a
1 changed files +9−9
Modifiedsrc/tracker.pas +9−9
@@ -944,19 +944,19 @@ begin
944 if LoadingFile or Playing then Exit; 944 if LoadingFile or Playing then Exit;
945 if (Note < LOWEST_NOTE) or (Note > HIGHEST_NOTE) then Exit; 945 if (Note < LOWEST_NOTE) or (Note > HIGHEST_NOTE) then Exit;
946 946
947 // MIDI input mirrors computer-keyboard behaviour: re-aim the instrument 947 // Unlike the computer keyboard, MIDI doesn't care about Lazarus focus -
948 // combo box at the current channel's bank and preview through that 948 // the notes come from a physical device. Preview always goes through
949 // instrument, then commit the note into the active cell. PreviewingInstrument 949 // PreviewForNoteEntry so the currently selected instrument (re-aimed to
950 // is tracked so the matching Note Off can silence the preview, the same 950 // the cursor's channel bank) is what plays; if that can't be done (e.g.
951 // way FormKeyUp handles a released computer key. 951 // no instrument selected) fall back to the generic PreviewNote.
952 if TrackerSettings.PreviewWhenPlacing 952 if PreviewForNoteEntry(Note) then
953 and (ActiveControl = TrackerGrid)
954 and PreviewForNoteEntry(Note) then
955 PreviewingInstrument := Note 953 PreviewingInstrument := Note
956 else 954 else
957 PreviewNote(Note); 955 PreviewNote(Note);
958 956
959 if (ActiveControl = TrackerGrid) and (TrackerGrid.Cursor.SelectedPart = cpNote) then 957 // Commit the note whenever the user is looking at the pattern editor,
958 // regardless of which sub-control (combo box, spinner, etc.) has focus.
959 if PageControl1.ActivePage = PatternTabSheet then
960 TrackerGrid.InputNoteValue(Note); 960 TrackerGrid.InputNoteValue(Note);
961 end; 961 end;
962 962