+2008-03-11 Jonathan Pobst <monkey@jpobst.com>
+
+ * ContainerControl.cs: We can't do MenuStrip implicit mnemonics
+ at the same time we do explicit ones, because we have to give all
+ other controls on the container a chance to handle explicit ones
+ first. If no one has an explicit mnemonic, then we can let the
+ MenuStrip have a shot at implicit mnemonics.
+ * MenuStrip.cs: Create an implicit mnemonic function.
+ * ToolStrip.cs: When processing explicit mnemonics, don't do implicit
+ mnemonics for MenuStrips.
+ [Fixes bug #368493]
+
2008-03-11 Jonathan Pobst <monkey@jpobst.com>
* AxHost.cs, Binding.cs, DataGridView.cs, DataGridViewCell.cs,
wrapped = false;
c = active_control;
+#if NET_2_0
+ System.Collections.Generic.List<MenuStrip> strips = new System.Collections.Generic.List<MenuStrip> ();
+#endif
+
do {
c = GetNextControl(c, true);
+#if NET_2_0
+ if (c is MenuStrip)
+ strips.Add ((MenuStrip)c);
+#endif
if (c != null) {
// This is stupid. I want to be able to call c.ProcessMnemonic directly
if (c.ProcessControlMnemonic(charCode)) {
}
} while (c != active_control);
+#if NET_2_0
+ // No one has an explicit mnemonic for this key.
+ // Let MenuStrips have a chance at implicit mnemonics.
+ foreach (MenuStrip ms in strips)
+ if (ms.ProcessImplicitMnemonic (charCode))
+ return true;
+#endif
+
return false;
}
return false;
}
+
+ internal bool ProcessImplicitMnemonic (char charCode)
+ {
+ string code = Char.ToUpper (charCode).ToString ();
+
+ // If any item's text starts with our letter, it gets the message
+ foreach (ToolStripItem tsi in this.Items)
+ if (tsi.Enabled && tsi.Visible && !string.IsNullOrEmpty (tsi.Text) && tsi.Text.ToUpper ().StartsWith (code))
+ return tsi.ProcessMnemonic (charCode);
+
+ return false;
+ }
private void ReorderMdiMenu ()
{
string code = Char.ToUpper (charCode).ToString ();
// If any item's text starts with our letter, it gets the message
- if (this is MenuStrip || this is ToolStripDropDownMenu)
+ if (this is ToolStripDropDownMenu)
foreach (ToolStripItem tsi in this.Items)
if (tsi.Enabled && tsi.Visible && !string.IsNullOrEmpty (tsi.Text) && tsi.Text.ToUpper ().StartsWith (code))
return tsi.ProcessMnemonic (charCode);