I have successfully implemented tooltips for individual cells by handling the GetActiveObjectInfo event of the tooltipcontroller. This works fine. I also want to have the same tooltips displayed when an editor is active. I read this article:
http://www.devexpress.com/Support/Center/Question/Details/A2008
This also works. However, when the editor is active, the other tooltips don't work.
So it seems I can have one or the other, but not both. Is there a way to do this?
Also, how can I find out which column the active editor is on?
XtraGrid tooltips in cells when editor is active.
Answers approved by DevExpress Support
Hello Brian,
To implement tool tips for the GridContol and its active editor it is necessary to create an additional condition in the GetActiveObjectInfo event handler:
C#private void ToolTipController_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
{
ToolTipControlInfo info = null;
GridHitInfo hInfo = gridView1.CalcHitInfo(e.ControlMousePosition);
Debug.WriteLine(hInfo.HitTest);
if (!(e.SelectedControl is GridControl))
{
object o = gridView1.ActiveEditor.ToString();
string text = "Test";
info = new ToolTipControlInfo(o, text);
e.Info = info;
}
else
{
if (hInfo.InRowCell)
{
string text = gridView1.GetRowCellDisplayText(hInfo.RowHandle, hInfo.Column);
info = new ToolTipControlInfo(gridControl1, text);
e.Info = info;
}
}
}
I have attached my test sample to illustrate this approach in detail. I hope you will find it useful.
That worked. I'm not sure I know what I did differently that broke it, but your solution works.
I'm glad to hear that my assistance was helpful to you. We are always happy to help you.