Add Ctrl+Enter as a way to close the LVTable edit dialog

When editing local variables, the data grid generally has the input
focus, so hitting Enter doesn't close the dialog.  Rather than play
games with the focus, just take Ctrl+Enter as a shortcut to close
the dialog (same as notes and long comments).

(I found myself hitting Ctrl+Enter automatically, and being annoyed
when it didn't work, so I figured I'd make it official.)
This commit is contained in:
Andy McFadden committed 2020-08-27 17:09:18 -07:00
1 parent 69a9e98a43
commit 7c506dceb6
2 files changed
+8 -1

No files matched your search

+2 -1
View File
@@ -25,7 +25,8 @@ limitations under the License.
Title="Edit Local Variable Table"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded">
Loaded="Window_Loaded"
PreviewKeyDown="Window_KeyEventHandler">
<Window.Resources>
<system:String x:Key="str_ConfirmDelete">Are you sure you want to delete the entire table?</system:String>
@@ -274,6 +274,12 @@ namespace SourceGen.WpfGui {
DialogResult = true;
}
private void Window_KeyEventHandler(object sender, KeyEventArgs e) {
if (e.Key == Key.Return && Keyboard.Modifiers.HasFlag(ModifierKeys.Control)) {
OkButton_Click(null, null);
}
}
private void DeleteTableButton_Click(object sender, RoutedEventArgs e) {
MessageBoxResult result = MessageBox.Show((string)FindResource("str_ConfirmDelete"),
(string)FindResource("str_ConfirmDeleteCaption"),