KB Article A2008
Visible to All Users

How to display a hint for an active editor within the XtraGrid

Description:
I want to show a tooltip for a text editor inside the XtraGrid. I tried to use the ToolTipController, but without success. Is there a way I can do this?

Answer:
Actually, it's possible to achieve this with the help of the ToolTipController using the following approach. First, within the GridView's ShownEditor event you should assign a new handler of the GetActiveObjectInfo event to the ToolTipController of the currently active editor. This is necessary because the Grid doesn't display hints for editors by default (please see the ToolTipController.GetActiveObjectInfo Event topic of the XtraGrid help file for details). Then within the GetActiveObjectInfo event you should create a new ToolTipControlInfo for the displayed editor and specify the hint text you wish to display. Then everything should work fine. Here is some sample code:

C#
private void gridView1_ShownEditor(object sender, System.EventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView gridView = sender as DevExpress.XtraGrid.Views.Grid.GridView; if (gridView.ActiveEditor.ToolTipController != null) { gridView.ActiveEditor.ToolTipController.GetActiveObjectInfo +=new DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventHandler(ToolTipController_GetActiveObjectInfo); } } private void ToolTipController_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { ToolTipControlInfo info = null; object o = gridView1.ActiveEditor.ToString(); string text = "Test"; info = new ToolTipControlInfo(o, text); e.Info = info; }

Attached you will find a sample project demonstrating this approach.
See Also:
How to customize the ToolTip for a TreeList cell
Showing a hint for a grid cell even if its content is completely visible
How to get multi-line tooltips with a specific width
How to programmatically display a tooltip for a control via the ToolTipController component
How to display hints only for particular cells

Show previous comments (1)
DevExpress Support Team 10 years ago

    Hello,
    To process your recent post in the most efficient manner, I have created a separate ticket on your behalf: T151460: Code from the "How to display a hint for an active editor within XtraGrid" example does not work. Let's continue our discussion there.

      I have the same Problem… is there still an answer?

      DevExpress Support Team 10 years ago

        Hello,

        In order not to mix several questions within one thread, I will extract your question to a new ticket. Let us continue our discussion there GridView.ActiveEditor gives null.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.