From a83e4a2b8e7ede469cedad825d062048b084a3f9 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 8 Oct 2018 16:23:22 -0700 Subject: [PATCH] Move menu items back to Actions menu when context menu closes Otherwise you can't open the Actions menu with Alt-A. This seems like a flaw in WinForms, but maybe there's a reason for it. (issue #26) --- SourceGen/AppForms/ProjectView.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SourceGen/AppForms/ProjectView.cs b/SourceGen/AppForms/ProjectView.cs index 60e2d46..e16b81c 100644 --- a/SourceGen/AppForms/ProjectView.cs +++ b/SourceGen/AppForms/ProjectView.cs @@ -283,6 +283,9 @@ namespace SourceGen.AppForms { // When the Actions or context menu are opened, all menu items get transferred over. codeListView.ContextMenuStrip.Opening += codeListView_CmsOpening; + // When the context menu closes, move all the menu items back to the Actions menu, + // so that you can open it with Alt-A. + codeListView.ContextMenuStrip.Closed += ActionsMenuOpening; // Set default widths, in case we don't have a value for this in AppSettings. CodeListColumnWidths widths = GetDefaultCodeListColumnWidths(); @@ -2518,7 +2521,8 @@ namespace SourceGen.AppForms { /// /// Handles an "opening" event for the ProjectView's Actions menu. /// - /// This puts all of the Actions menu items in the Actions menu. + /// This puts all of the Actions menu items in the Actions menu. We also want to call + /// this when the context menu closes, so that Alt-A will open the menu. /// private void ActionsMenuOpening(object sender, EventArgs e) { actionsToolStripMenuItem.DropDownItems.AddRange(mActionsMenuItems);