J
jdlwright
Hi,
I can barely believe that searching for "contextmenu richtextbox event"
in google groups found only a handful of results and none relevant to
this problem... so it must be me doing something wrong (although, I can
double-barely-believe that ;-))
The problem is, if I press the Apps key while in a RichTextBox, to
trigger my context menu, the Popup event is fired twice (whereas if I
use the right mouse button, it's fire once). This problem doesn't
exist with TextBox.
Steps to reproduce.
1. Drop a RichTextBox and ContextMenu onto a Form
2. Set RichTextBox.ContextMenu to your ContextMenu
(3. I added a menu item, but maybe this is unimportant)
4. Add an event listener to the Popup event
this.contextMenu1.Popup += new
System.EventHandler(this.contextMenu1_Popup);
5. put a breakpoint on your event handler method
6. press the Apps key to trigger the CM inside the RTB, and you'll see
the break point hit twice (btw I checked to make sure that the
duplicate event wasn't caused by using breakpoints to debug - I did
this using an int counter and a break point on a button).
So is this a bug/"it's-by-design ;-/"? Any elegant solutions??
Thanks,
Jim
I can barely believe that searching for "contextmenu richtextbox event"
in google groups found only a handful of results and none relevant to
this problem... so it must be me doing something wrong (although, I can
double-barely-believe that ;-))
The problem is, if I press the Apps key while in a RichTextBox, to
trigger my context menu, the Popup event is fired twice (whereas if I
use the right mouse button, it's fire once). This problem doesn't
exist with TextBox.
Steps to reproduce.
1. Drop a RichTextBox and ContextMenu onto a Form
2. Set RichTextBox.ContextMenu to your ContextMenu
(3. I added a menu item, but maybe this is unimportant)
4. Add an event listener to the Popup event
this.contextMenu1.Popup += new
System.EventHandler(this.contextMenu1_Popup);
5. put a breakpoint on your event handler method
6. press the Apps key to trigger the CM inside the RTB, and you'll see
the break point hit twice (btw I checked to make sure that the
duplicate event wasn't caused by using breakpoints to debug - I did
this using an int counter and a break point on a button).
So is this a bug/"it's-by-design ;-/"? Any elegant solutions??
Thanks,
Jim