Hi,
Is there a way to delay when the built-in tooltip on a cell shows up. When I hover over a cell that has more text than will fit in the display area of the cell, it pops a tooltip up over the cell that gives the full text of the cell. I just want to delay when the cell tooltip pops up.
Thanks,~Karen
Hi Karen,
No, there's no way to change the delay. You could turn off the grid's built-in tooltips and apply your own.
Note there there was a bug in the grid where the tooltips were showing up instantly with no delay at all. This bug was fixed, so if that's the problem you are having, you should get the latest Hot Fix.
Hello,
I have a multi-column tree (Outlook style), where I have set an UltraTooltipManager so I can display custom tooltips.
The problem is, when I hover over the tree nodes, the tooltip changes instantly, and thus it is always displayed (with changing content). This is a disturbing behaviour, because the never-hiding tooltip hides adjacent nodes.
Is it the bug you are talking about ? Or is there a way to have a delay between two tooltips of different tree nodes (but not the cells of a same node) ?
Juscher said:Is it the bug you are talking about ? Or is there a way to have a delay between two tooltips of different tree nodes (but not the cells of a same node) ?
No, the bug I was referring to was a bug in the WinGrid, not the tree. And it was fixed a long time ago.
I'm not sure what's happening in this case, but it sounds like you are calling ShowToolTip directly instead of assigning the tooltip you want to the tree control. ShowToolTip shows the tooltip immediately. If you assign the tooltip to the tree based on the mouse position, then there will be the usual delay.
Indeed, I do call the ShowToolTip method, but it seems I am calling it correctly, since I have the tree as argument of the method.
Ok, it's time I show you my code. Here is the event method in a component that holds my UltraTree :
private void treeView_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e) { Point pt = new Point(e.Element.Rect.X, e.Element.Rect.Y); Infragistics.Win.UltraWinTree.UltraTreeNode node = this.treeView.GetNodeFromPoint(pt); if (node != null) { TreeNodeTag nodeTag = node.Tag as TreeNodeTag; if (nodeTag.Element != null) { Infragistics.Win.UltraWinToolTip.UltraToolTipInfo tipInfo = new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo(nodeTag.Information, Infragistics.Win.ToolTipImage.Default, "", Infragistics.Win.DefaultableBoolean.True); this.ultraToolTipManager1.SetUltraToolTip(this.treeView, tipInfo); this.ultraToolTipManager1.ShowToolTip(this.treeView); this.ultraToolTipManager1.GetUltraToolTip(this.treeView); } else { this.ultraToolTipManager1.HideToolTip(); this.ultraToolTipManager1.SetUltraToolTip(this.treeView, null); } } }
With this code, there is a delay only the first time a tooltip is displayed, and then when my mouse goes from node to node, there is no delay anymore. Only the contents of the tooltip changes of course, but the tooltip is not hidden until I leave the tree.
I want to tooltip to hide when I leave the node. What am I doing wrong ?
If you call the ShowToolTip method the tooltip will display immediately. It's a method call, so it would not make sense if you called the method and had to wait for the tooltip to show up. This method is intended to allow you to show a tooltip immediately. So it seems like you should never be calling ShowToolTip.
If you want the ToolTipManager to handle the delay for you, then you need to apply a tooltip to the control, either using SetUltraToolTip or GetUltraToolTip and setting properties on the UltraToolTip that you get back. You might have to call HideToolTip any time the mouse moves from one item to another in order to reset the delay.
Another option would be to use a timer and then call ShowToolTip, so that way you have total control over the delay.
Here's some quick sample code that seems to work for me and is a little simpler than what you have here:
private UltraTreeNode lastToolTipNode = null; private void ultraTree1_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e) { UltraTree tree = (UltraTree)sender; UltraTreeNode node = e.Element.GetContext(typeof(UltraTreeNode)) as UltraTreeNode; if (node == null) this.ultraToolTipManager1.HideToolTip(); if (node == this.lastToolTipNode) return; UltraToolTipInfo ultraToolTipInfo = this.ultraToolTipManager1.GetUltraToolTip(tree); this.ultraToolTipManager1.HideToolTip(); ultraToolTipInfo.ToolTipText = node.Text; }
Thank you Mike, that's exactly the behaviour I was looking for.
I had just to make two changes to your sample code :
1/ Because of null exception for the node :
if (node == null) { this.ultraToolTipManager1.HideToolTip(); return; }2/ Removed this because lastToolTipNode is never set : if (node == this.lastToolTipNode) return;Why is the variable lastToolTipNode useful ?
Ok, I have all I need ! Thank you very much, Mike.
1) Yeah, that makes sense.
2) The point of the lastToolTipNode was to ensure that we don't hide the tooltip while the mouse is moving within a node. Since the code is using MouseEnterElement, you could move the mouse over some text in a node and the tooltip would show up. Then maybe you move the mouse over the node's image and the event will fire again (since you entered an ImageUIElement) and hide the tooltip. So by keeping track of the last node we showed the tooltip for, we can avoid hiding it in the case where the event fires for a different element within the same node.
So basically, you would just set the lastToolTipNode at the same time that you set the ToolTipText.