We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

OnHitTest cann''t be triggered in custom grid cell

Hi experts,

I met a problem in custom grid cell. I have 2 classes: A and it's subclass B. A has a protected gridcontrol variable, say C. C will use the custom grid cell to respond user click action. when I run the program with A, everything goes well; but when I run B, I cann't catch any mouse event at all. And the OnHitTest method will never be triggered no matter how I click or move the mouse over the gridcontrol. I don't know what blocks this event from being called.

Any idea on this?

Thanks very much!

5 Replies

RC Rajadurai C Syncfusion Team October 27, 2009 12:46 PM UTC

Hi Chen,

Thanks for your interest in Syncfusion Products.

Please refer to the attached sample in which the gridcontrol is initialized in Form1 with protected access. While running the program with class A derived from Form1 class, the custom gridcell fires the CellHitTest event when it is hovered, which can be observed in the console window.
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90963.zip

Regards,
Rajadurai


CY Chen Yujun October 28, 2009 08:13 AM UTC

Thanks Rajadurai!

You sample project works well. my code is very similar with yours except for extra business logic inside it, but the CellHitTest event of my gridcontrol just never get fired. it seems it's the grid Control that drop the mouse event, not the custom cell. I really don't know why, and I just guess the reason and try to solve it but no progress for now.

Normally in which condition the gridcontrol will ignore the mouse hover action?



RC Rajadurai C Syncfusion Team October 28, 2009 09:02 AM UTC

Hi Chen,

Thanks for your update.

The custom cell can trigger the hit test only when it is enabled. By default, a custom gridcell in a grid will be in disabled state until its container cell gets activated. In the attached modified sample, the CellHitTest event of customcell grid is also handled. It can be observed in the console window that, when the cell containing the customgridcell is focussed, the CellHitTest event of the embedded grid in the custom cell, get fired.
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90963a.zip

The gridcontrol will ignore the mousehover action when it is in disabled state. You can observe this by setting the Enabled property of gridcontrol to false.

Regards,
Rajadurai


CY Chen Yujun October 29, 2009 02:42 AM UTC

Hi Rajadurai

That's it! My gridControl's enabled Property is in false because its container panel is disabled. I do this because I don't want user edit the value in the grid. maybe i need to reconsider my logic:-)

Thank you very much!


RC Rajadurai C Syncfusion Team October 29, 2009 06:55 AM UTC

Hi Chen,

Thanks for your update.

If you would like to restrict the users from editing the grid cell values, then you can make use of the following setting without disabling the container control.

//this setting allows to place cursor in gridcell but doesn't allow editing
this.grid.TableStyle.ReadOnly = true;

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon