From 2b6a76fad0d15a1652bd821fa21d6f9645d2d590 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 11 Oct 2018 17:03:08 -0700 Subject: [PATCH] Recognize mouse thumb-button for navigate-back There's a common convention for using one of the thumb buttons on the side of the mouse to mean "back", notably in web browsers. I keep hitting it without thinking about it, so let's just make it official. --- SourceGen/AppForms/ProjectView.Designer.cs | 2 +- SourceGen/AppForms/ProjectView.cs | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/SourceGen/AppForms/ProjectView.Designer.cs b/SourceGen/AppForms/ProjectView.Designer.cs index 4416b4c..bfa9275 100644 --- a/SourceGen/AppForms/ProjectView.Designer.cs +++ b/SourceGen/AppForms/ProjectView.Designer.cs @@ -1222,8 +1222,8 @@ namespace SourceGen.AppForms this.codeListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.codeListView_RetrieveVirtualItem); this.codeListView.SelectedIndexChanged += new System.EventHandler(this.codeListView_SelectedIndexChanged); this.codeListView.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.codeListView_VirtualItemsSelectionRangeChanged); - this.codeListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.codeListView_MouseClick); this.codeListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.codeListView_MouseDoubleClick); + this.codeListView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.codeListView_MouseDown); // // columnOffset // diff --git a/SourceGen/AppForms/ProjectView.cs b/SourceGen/AppForms/ProjectView.cs index 864e340..4fb3934 100644 --- a/SourceGen/AppForms/ProjectView.cs +++ b/SourceGen/AppForms/ProjectView.cs @@ -1963,15 +1963,12 @@ namespace SourceGen.AppForms { dlg.Dispose(); } - private void codeListView_MouseClick(object sender, MouseEventArgs e) { - //if (e.Button == MouseButtons.Left) { - // Debug.WriteLine("LEFT CLICK"); - //} else if (e.Button == MouseButtons.Right) { - // Debug.WriteLine("RIGHT CLICK"); - // //ShowRightClickMenu(); - //} else { - // Debug.WriteLine("CLICK " + e.Button); - //} + private void codeListView_MouseDown(object sender, MouseEventArgs e) { + // MouseClick only fires for certain buttons and certain locations. MouseDown + // fires for all buttons so long as the pointer is in the codeListView area. + if (e.Button == MouseButtons.XButton1 && navigateBackToolStripButton.Enabled) { + navigateBackToolStripButton_Click(sender, e); + } } private void codeListView_MouseDoubleClick(object sender, MouseEventArgs e) {