From 71ebf82e7a30c389d2990360e417061931ece87b Mon Sep 17 00:00:00 2001 From: Joe Date: Sat, 3 May 2025 16:08:17 -0600 Subject: [PATCH] Allow hotkey specifier to be at any position in label Allow hotkey specifier to be at any position in label "D_irectory" doesn't work because hotPos is hardcoded 0 --- Examples/UICatalog/Scenarios/FileDialogExamples.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Examples/UICatalog/Scenarios/FileDialogExamples.cs b/Examples/UICatalog/Scenarios/FileDialogExamples.cs index 4fcbbcd2f4..fc32b7527d 100644 --- a/Examples/UICatalog/Scenarios/FileDialogExamples.cs +++ b/Examples/UICatalog/Scenarios/FileDialogExamples.cs @@ -164,7 +164,15 @@ private void CreateDialog () var fd = new FileDialog { OpenMode = Enum.Parse ( - _rgOpenMode.RadioLabels.Select (l => TextFormatter.RemoveHotKeySpecifier(l, 0, _rgOpenMode.HotKeySpecifier)).ToArray() [_rgOpenMode.SelectedItem] + _rgOpenMode.RadioLabels + .Select (l => TextFormatter.FindHotKey (l, _rgOpenMode.HotKeySpecifier, out int hotPos, out Key _) + + // Remove the hotkey specifier at the found position + ? TextFormatter.RemoveHotKeySpecifier (l, hotPos, _rgOpenMode.HotKeySpecifier) + + // No hotkey found, return the label as is + : l) + .ToArray () [_rgOpenMode.SelectedItem] ), MustExist = _cbMustExist.CheckedState == CheckState.Checked, AllowsMultipleSelection = _cbAllowMultipleSelection.CheckedState == CheckState.Checked