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.
Mike,
Two questions regarding two unrelated requirements:
- I have a column with icons displayed representing some underlying values. I would like a tooltip on the icon to say what it means (eg: red dot - status trouble, green dot- status fine, etc) What is the best approach to do this? Is there a way to tell the tooltipmanager that I want tooltip for a complete grid column and tell it what the various tooltips are for each underlying values of icon?
- Unrelated to the above question, I have another requirement to show tooltip for each cell but with a delay. I found from previous posts that it is possible to set tooltip on individual cells using the tooltip property but it shows without delay. For getting the delay, based on your suggestion, I would need to use the ToolTipManager
a) what control would I associate the tooltipmanager with
b) To set the tooltip value, I have to trap the mouse enter event, find the underlying cell and set the tooltip value?
Thanks!
vrn said:- I have a column with icons displayed representing some underlying values. I would like a tooltip on the icon to say what it means (eg: red dot - status trouble, green dot- status fine, etc) What is the best approach to do this? Is there a way to tell the tooltipmanager that I want tooltip for a complete grid column and tell it what the various tooltips are for each underlying values of icon?
What you would do is trap the MouseMove event of the grid and determine which cell the mouse is over. Then you would set the text on the ToolTip for the grid based on the location of the mouse. This is pretty much how tooltips work for every control. The tooltip is associated with the entire control, so if you want different tooltips for different areas, you have to change the tooltip as the mouse moves.
vrn said: a) what control would I associate the tooltipmanager with
The UltraGrid control.
vrn said: b) To set the tooltip value, I have to trap the mouse enter event, find the underlying cell and set the tooltip value?
You would use the MouseMove event. Or maybe MouseEnterElement. Then you have to determine what the mouse is over. You do this using the ElementFromPoint method. Check out the Infragistics Knowledge Base and do a search for "ElementFromPoint". There are a whole bunch of articles on using this technique to get a cell, row, or column from a mouse point.
Mike Saltzman"]You would use the MouseMove event. Or maybe MouseEnterElement. Then you have to determine what the mouse is over. You do this using the ElementFromPoint method.
Is it a problem if a set of related grids share an instance of the tooltipmanager?
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.