Ticket T146072
Visible to All Users

MouseEnter and MouseLeave Events

created 11 years ago

Hello,

I need to show the "Hand Cursor" when user put mouse cursor over a specific column, in my cxGrid. I know that I should use the MouseEnter and MouseLeave events, but I couldn´t discover how to check if mouse is over a specific column or not.

Thank you very much in advance.

Answers approved by DevExpress Support

created 11 years ago

You can use our HitTest technology to determine the grid ViewInfo element under the mouse cursor. I suggest that you review the "Understanding HitTests" help topic and related topics for information on this feature. In addition, take a look at the How to Implement a Hot Track Feature Knowledge Base article that provides a very helpful example of how to use HitTests.

    Show previous comments (3)
    DevExpress Support Team 11 years ago

      Fernando,

      1. You are saying that you have found "something" in the IDE help system, but not in Delphi. I am afraid that I do not understand what you mean by saying this. It looks like the help system is somehow corrupted on your side. Would you please describe this problem in detail? Perhaps, we will be able to offer a solution for you.

      2. My advice regarding the usage of the HitTest technology was related to your initial question. You asked "how to check if mouse is over a specific column or not?". In this case, the OnMouseMove event and the HitTest technology is a good solution. After your clarification, I see that you handled the OnCellClick event and wish to execute a custom code only when clicking to a certain column. It is simple to do so by using the following code:

      Delphi
      if ACellViewInfo.Item = cxGrid1TableView1arquivo_path then //CustomCode

      Please test this solution on your side and let me know the result.

      FF FF
      Fernando Fernandes 3 11 years ago

        Paulo,
        I´m sorry, I meant to say that I found topics about the HitTest in the IDE help system, but not in Delphi LANGUAGE. hahaha I´m sorry again.
        About the HitTest: I´ve already implemented the solution using MouseMove, to another task, and it was sucessfull. Now, I need to implement this task to the onCellClick. I tried to verify through the way that you mentioned, but it didn´t worked. Below is the code that I´m using. Nothing happens when I click to the cell.
        procedure TinsereImovel_form.cxGrid1TableView1CellClick(
         Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo;
         AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
        var linha: integer;
           AColumn: TcxGridColumn;
           AView: TcxGridTableView;
           link: string;
        begin
         inherited;
         if ACellViewInfo.Item = cxGrid1TableView1arquivo_path then
         begin
           linha := cxGrid1TableView1.Controller.SelectedRecords[0].RecordIndex;
           AView := cxGrid1TableView1;
           AColumn := TcxGridDBColumn(AView.FindItemByName('cxGrid1TableView1arquivo_path'));
           link := cxGrid1TableView1.DataController.Values[linha, AColumn.Index];
           ShellExecute(Handle, 'open', PWideChar(link), nil, nil, SW_SHOWNORMAL);
         end;
        end;
        I´m feeling very bad to paste code like this ugly :(

        FF FF
        Fernando Fernandes 3 11 years ago

          Forget it, I was using the wrong column to make the test!
          Thank you very much Paulo!

          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.