I'm trying to create and handle some shortcut keys on a Ribbon. First, I used the shortcut property provided on the Tool. This worked except for a TextBoxTool on a not selected tab. I have a support request in Development right now on this. While waiting, I tried to see if I could work around it manually. What I've done is add a MessgeFilter to capture the key press windows message, I then filter out and process the F keys. It all works except my text box again. This is my code:
Dim TabTool As Infragistics.Win.UltraWinToolbars.RibbonTabTabTool = Me.ToolbarManager.Ribbon.Tabs("Home")Me.ToolbarManager.Ribbon.SelectedTab = TabToolDim TextTool As Infragistics.Win.UltraWinToolbars.TextBoxToolTextTool = Me.ToolbarManager.Ribbon.Tabs("Home").Groups("QuickLaunch").Tools("Quick Search")TextTool.IsActiveTool = TrueTextTool.IsInEditMode = True
This causes the same error that I reported using the built in shortcut key property, "Can't activate a tool that is not visible." It seems that the SelectedTab change does not happen right away and therefore the TextBoxTool is still not visible (because the tab has not switched). If I comment out the "TextTool" code, it will switch to the "Home" tab without any problems. Also, if I'm already on the "Home" tab, the "TextTool" code will work exactly as expected; setting focus to the TextBoxTool. Any ideas how to make these play nice together?
Thanks Mike - One of the support people had suggested this work-around and it is working perfectly for me. Thanks for you help.
This issue was fixed on 4/1/10 (issue TFS30074) in versions 9.1 and later. Download the latest SR if you are using one of these versions. If not, you can work around this by adding the following event handler for BeforeShortcutKeyProcessed on the UltraToolbarsManager:
Private Sub UltraToolbarsManager1_BeforeShortcutKeyProcessed(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.BeforeShortcutKeyProcessedEventArgs) Handles UltraToolbarsManager1.BeforeShortcutKeyProcessed If e.Tool.Key = "TextBoxTool1" Then Me.UltraToolbarsManager1.Ribbon.SelectedTab = Me.UltraToolbarsManager1.Ribbon.Tabs(0) CType(Me._Form1_Toolbars_Dock_Area_Top, Infragistics.Win.IUltraControlElement).MainUIElement.VerifyChildElements() End IfEnd Sub
Any ideas? Anyone?