show tooltip even if treeview doesn't have focus?
-
I'm making a vs.net addin which has a custom treeview, in a custom toolwindow. I'm trying to replicate some of the basic features of the solution-explorer treeview but i have come across a snag when trying to show a tooltip for a partially visible treenode, when my treeview control doesn't have focus. Basically ToolTip.Show(...) fails to show a tooltip when my treeview isn't focused. vs.net can surprisingly do this in its solution-explorer treeview so long as vs.net has focus... it's treeview doesn't need focus. You can be typing away in the ide and mouse hover over a half visible file in the solution explorer and see its tooltip. I want that functionality for my treeview :P
-
I'm making a vs.net addin which has a custom treeview, in a custom toolwindow. I'm trying to replicate some of the basic features of the solution-explorer treeview but i have come across a snag when trying to show a tooltip for a partially visible treenode, when my treeview control doesn't have focus. Basically ToolTip.Show(...) fails to show a tooltip when my treeview isn't focused. vs.net can surprisingly do this in its solution-explorer treeview so long as vs.net has focus... it's treeview doesn't need focus. You can be typing away in the ide and mouse hover over a half visible file in the solution explorer and see its tooltip. I want that functionality for my treeview :P
Can you trap the mouseover event on the node (does the node have a mouseover event) even if the control is not selected? Then handle the tooltip manually. If the node does not then use the treeview and hittest. Still it will be a lot of faffing about to get a tooltip.
Never underestimate the power of human stupidity RAH
-
Can you trap the mouseover event on the node (does the node have a mouseover event) even if the control is not selected? Then handle the tooltip manually. If the node does not then use the treeview and hittest. Still it will be a lot of faffing about to get a tooltip.
Never underestimate the power of human stupidity RAH
yes in my derived treeview i override OnMouseMove and this code does seem to execute even if the control isnt focused... atleast the breakpoint fires when i slide the mouse over the non-focused control. It's just the call to toolTip.Show(...) which fails to display a tooltip when the control has no focus. hmm. ok i checked out the Tooltip class with reflector and i see the problem. "IsWindowActive"... microsoft explicitly checks for being "active" before allowing a tooltip to show... i'll do more digging to see if their's an acceptable alternative to being focused. //from .net framework ToolTip class public void Show(string text, IWin32Window window, int x, int y) { if (window == null) { throw new ArgumentNullException("window"); } if (this.HasAllWindowsPermission && this.IsWindowActive(window)) { NativeMethods.RECT rect = new NativeMethods.RECT(); UnsafeNativeMethods.GetWindowRect(new HandleRef(window, Control.GetSafeHandle(window)), ref rect); int pointX = rect.left + x; int pointY = rect.top + y; this.SetTrackPosition(pointX, pointY); this.SetTool(window, text, TipInfo.Type.Absolute, new Point(pointX, pointY)); } }
-
yes in my derived treeview i override OnMouseMove and this code does seem to execute even if the control isnt focused... atleast the breakpoint fires when i slide the mouse over the non-focused control. It's just the call to toolTip.Show(...) which fails to display a tooltip when the control has no focus. hmm. ok i checked out the Tooltip class with reflector and i see the problem. "IsWindowActive"... microsoft explicitly checks for being "active" before allowing a tooltip to show... i'll do more digging to see if their's an acceptable alternative to being focused. //from .net framework ToolTip class public void Show(string text, IWin32Window window, int x, int y) { if (window == null) { throw new ArgumentNullException("window"); } if (this.HasAllWindowsPermission && this.IsWindowActive(window)) { NativeMethods.RECT rect = new NativeMethods.RECT(); UnsafeNativeMethods.GetWindowRect(new HandleRef(window, Control.GetSafeHandle(window)), ref rect); int pointX = rect.left + x; int pointY = rect.top + y; this.SetTrackPosition(pointX, pointY); this.SetTool(window, text, TipInfo.Type.Absolute, new Point(pointX, pointY)); } }
Then you'll find there is something buried under NativeMethods.RECT that needs addressing, 2 weeks from now you will be pushing 1s and 0s at the hardware :laugh: .
Never underestimate the power of human stupidity RAH
-
Then you'll find there is something buried under NativeMethods.RECT that needs addressing, 2 weeks from now you will be pushing 1s and 0s at the hardware :laugh: .
Never underestimate the power of human stupidity RAH
ya... i could decompile tooltip... recompile without the offending check... or i can just let this one slide lol