Hello
how is it possible to read cell value and display tooltip on mouse hover in a grid .
i tryed the
UIElement element = ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(mousePoint);
{
}
but it does not work
My guess is that MousePosition returns you the position of the mouse in screen coordinates, not control coordinates. You can probably convert the coords using grid.PointToClient. Or you can use the MouseMove even and use e.X and e.Y.
Or, you could use grid.DisplayLayout.UIElement.LastElementEntered, instead of ElementFromPoint.
Or, you could use MouseEnterElement and MouseLeaveElement, as suggested above. :)
Mike, using the MouseEnterElement and MouseLeaveElement approach, can one introduce a tool tip delay i.e. it takes some time before the tool tip shows? Would one just sleep for a few millisecond and then cause the tooltip to show?
Well, if you use the ShowToolTip method, then the tooltip will show up immediately.You could use a Timer to introduce a delay, I suppose.
Another option would be to change the ToolTip on the control based on the location of the mouse. You would do this using the UltraToolTipManager.GetUltraToolTip method. And then you can set properties on the UltraToolTip settings for that control. This way the UltraToolTipManager would handle the delay for you.
I just found it, thank you Mike
Sorry I'm new to Infragistics, where can I find the "samples" folder ?
There's a sample included with the NetAdvantage SDK that does exactly what you are trying to do.
Samples\WinMisc\CS\ToolTipManager\ToolTips with Context CS
The sample uses a base class with a method called PrepareTooltip and then derives a class for the grid that overrides this method. So you could copy these two classes into your application and then just handle the PrepareToolTipMethod on the "ToolTipContextHelperForGrid" class.
Mike,
You said
Mike Saltzman"] Well, if you use the ShowToolTip method, then the tooltip will show up immediately.You could use a Timer to introduce a delay, I suppose. Another option would be to change the ToolTip on the control based on the location of the mouse. You would do this using the UltraToolTipManager.GetUltraToolTip method. And then you can set properties on the UltraToolTip settings for that control. This way the UltraToolTipManager would handle the delay for you.
It worked but I get a tool tip to show ONLY the first time I enter a cell in that Grid. After that the only way to make the tooltip show is to either hover over outside that Grid and re-enter. Another way (little weird) is to click on another row in the same Grid and then hover over some cell. Those are these only two casesThe debugger tells me the MouseEnterElement handler is being invoked each time I hover over to a new cell.
On MouseEnterElement:
this.ultraToolTipManager1.InitialDelay = 500; Infragistics.Win.UltraWinToolTip.UltraToolTipInfo toolTipInfo = this.ultraToolTipManager1.GetUltraToolTip((UltraGrid)sender);toolTipInfo.ToolTipText = "hello"; // cell specific information here//this.ultraToolTipManager1.ShowToolTip((UltraGrid)sender);
If I uncomment the ShowToolTip method call above, I get the tooltip to show for each cell immediately as soon as I enter that cell.
What am I doing incorrect?
Thanks!
No, not at all. The ToolTipManager can handle any number of controls. You just need to make sure that you are setting the tooltip on the right grid control.