Ticket A2666
Visible to All Users

How to programmatically display cell hints within a grid

created 20 years ago (modified 2 years ago)

Description:
I want to display my own cell hints when the mouse moves over grid cells. How to do this?

Answer:
To implement this task you should handle the GridView’s OnMouseMove event. Within this event you should check whether the mouse is placed over a grid cell:

Code
//determine the current mouse position AHitTest := cxGrid1DBTableView2.GetHitTest(X, Y); //hide displayed hint if mouse is not over a grid cell if AHitTest.HitTestCode <> htCell then begin Timer1.Enabled := False; cxHintStyleController1.HideHint; Exit; end;

If so you should display a cell hint. To display/hide a hint you can use the TcxHintStyleController component. Simply call its ShowHint method to display a hint and its HideHint method to hide the hint which is currently displayed.
The attached project demonstrates this approach.
Please note that the GridView.OptionsBehavior.CellHints property is disabled. Otherwise, the GridView will show its CellHints too.

Comments (3)

    Hello, I have been seeking help to implement custom hints in pivotgrid, but was unable to make it work.
    Would send me an example?
    Thanks!
    Wander

    DevExpress Support Team 10 years ago

      Hello,

      To process your recent post more efficiently, I created a separate ticket on your behalf: T220686: How to implement custom hints in pivotgrid. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

      DevExpress Support Team 6 years ago

        Example with TClientDataSet

        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.