From ae744f1077ef7d7ce8f7bf84eba94846ee41c871 Mon Sep 17 00:00:00 2001 From: scoped Date: Sun, 22 Feb 2026 12:21:38 -0500 Subject: [PATCH] Update MainWindow.xaml.cs to replace HotkeyRecorderText with HotkeyRecorderButton for displaying hotkey information, enhancing user interaction during hotkey recording. Adjustments made to ensure proper focus and event handling for the button. --- ClipForge/MainWindow.xaml.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ClipForge/MainWindow.xaml.cs b/ClipForge/MainWindow.xaml.cs index 6e57291..e9cde1e 100644 --- a/ClipForge/MainWindow.xaml.cs +++ b/ClipForge/MainWindow.xaml.cs @@ -182,8 +182,8 @@ namespace ClipForge QualityLabel.Text = $"{s.VideoQuality}%"; FramerateCombo.SelectedIndex = s.Framerate == 30 ? 0 : 1; StartupToggle.IsOn = IsStartupEnabled(); - if (HotkeyRecorderText != null) - HotkeyRecorderText.Text = HotkeyHelper.ToDisplayString((uint)s.HotkeyModifiers, (uint)s.HotkeyVirtualKey); + if (HotkeyRecorderButton != null) + HotkeyRecorderButton.Content = HotkeyHelper.ToDisplayString((uint)s.HotkeyModifiers, (uint)s.HotkeyVirtualKey); } // --- STARTUP WITH WINDOWS --- @@ -255,8 +255,9 @@ namespace ClipForge { if (_isRecordingHotkey) return; _isRecordingHotkey = true; - HotkeyRecorderText.Text = "Press any key..."; - this.KeyDown += OnHotkeyCaptureKeyDown; + HotkeyRecorderButton.Content = "Press any key..."; + HotkeyRecorderButton.Focus(FocusState.Programmatic); + HotkeyRecorderButton.KeyDown += OnHotkeyCaptureKeyDown; } private void OnHotkeyCaptureKeyDown(object sender, KeyRoutedEventArgs e) @@ -280,9 +281,9 @@ namespace ClipForge var ok = _hotkeyService.UpdateHotkey(mod, vk); var display = HotkeyHelper.ToDisplayString(mod, vk); - HotkeyRecorderText.Text = ok ? display : display + " (in use?)"; + HotkeyRecorderButton.Content = ok ? display : display + " (in use?)"; - this.KeyDown -= OnHotkeyCaptureKeyDown; + HotkeyRecorderButton.KeyDown -= OnHotkeyCaptureKeyDown; _isRecordingHotkey = false; }