Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
TextBoxTool.IsActiveTool = True causes "Can't activate a tool that is not visible."
posted

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.RibbonTab
TabTool = Me.ToolbarManager.Ribbon.Tabs("Home")
Me.ToolbarManager.Ribbon.SelectedTab = TabTool
Dim TextTool As Infragistics.Win.UltraWinToolbars.TextBoxTool
TextTool = Me.ToolbarManager.Ribbon.Tabs("Home").Groups("QuickLaunch").Tools("Quick Search")
TextTool.IsActiveTool = True
TextTool.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?