Hi all,
I experienced the following problem when dealing with the ToolbarsManager in a usercontrol:
In a usercontrol I assigned shortcuts the tools that deal with cut/copy/paste (context-menu toolbar as described in the "how to" article).
Now the shortcuts seem to trap all such keypresses on the entire form, means that if I press CTRL+C (copy) or CTRL-V (paste) when focus is on a textbox on the form (not in the usercontrol) it doesnt work anymore.
Instead the action is always executed on the usercontrol. That means that if I use PASTE in a textbox on a form, the paste command is executed in the textbox on the usercontrol that hosts the context-menu with the bound shortcuts.
How should I deal with this problem?
Looking foreward to your replies,best regardsAndy
Handle the UltraToolbarsManager.BeforeShortcutKeyProcessed event. When the event is fired for the copy or paste tools, check the ContainsFocus property of the UserControl. If it is False, set e.Cancel on the event args to True to prevent the shortcut from being processed.
I came across one problem. I added ultraToolbarsManager1 in one usecontrol and added another ultraToolbarsManager2 in another usercontrol. They both had one shotcut(ctrl+c), no matter where I press ctrl+c, it will excute the copy action in ultraToolbarsManager1. Do you know what's the problem and how can do copy action for ultraToolbarsManager2.
It depends where the focus is at the time the shortcut is pressed. I believe if you have a control that's focused on the second user control, it should send the shortcut to the toolbars manager on that control.
Are your toolbars managers merged together? What kind of tools are in the Tools collection?
Hi Mike,
Thanks for your quick reply.
When I debuged it I found that ultraToolbarsManager1.Tools.Count=2, you can found the tool in ultraToolbarsManager1 which was defined in ultraToolbarsManager2. It is very weird, I did not know how it happen as I only added one tool(ctrl+c) in ultraToolbarsManager1. Do you have any suggestion about it.
Thank you very much.