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.
Unfortunately, activation email could not send to your email. Please try again.

OnHitTest cann''t be triggered in custom grid cell

Thread ID:

Created:

Updated:

Platform:

Replies:

90963 Oct 27,2009 05:57 AM Oct 29,2009 02:55 AM Windows Forms 5
loading
Tags: GridControl
Chen Yujun
Asked On October 27, 2009 05:57 AM

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!

Rajadurai C [Syncfusion]
Replied On October 27, 2009 08:46 AM

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

Chen Yujun
Replied On October 28, 2009 04:13 AM

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?


Rajadurai C [Syncfusion]
Replied On October 28, 2009 05:02 AM

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

Chen Yujun
Replied On October 28, 2009 10:42 PM

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!

Rajadurai C [Syncfusion]
Replied On October 29, 2009 02:55 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;