[Mono-dev] ContextMenuStrip Work incorrectly
jingnan si
jingnan.si at gmail.com
Mon Apr 6 00:56:38 EDT 2009
Hi,
When the context menu contains ToolStripDropDownItem and a normal
ToolStripItem, the normal ToolStripItem will not function after the
ToolStripDropDown show and hide, I have attached the simple test project.
Just right click on the form and bring up the context menu.
I am using the lastest code from svn.
After some research, I create a simple fix to make the ToolStripItem Work,
but I don't think the fix solved the bug, it just solved my program, please
find the diff below.
Best Regards,
Jingnan Si
Index: class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
===================================================================
--- class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs (Version
131066)
+++ class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs (Work
copy)
@@ -1521,6 +1521,12 @@
foreach (ToolStripItem tsi2 in this.Items)
if (tsi != tsi2)
tsi2.Dismiss (ToolStripDropDownCloseReason.Keyboard);
+
+ if (Application.KeyboardCapture != this) {
+ Application.KeyboardCapture = this;
+ }
+
+ KeyboardActive = true;
}
internal virtual bool OnMenuKey ()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090406/63865bea/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestContextMenuStrip.tar.gz
Type: application/x-gzip
Size: 53554 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090406/63865bea/attachment-0001.gz
More information about the Mono-devel-list
mailing list