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
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.
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 ?
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; }
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.