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.
Syncfusion Feedback

HitTest

Thread ID:

Created:

Updated:

Platform:

Replies:

88802 Aug 12,2009 09:54 AM Sep 7,2009 02:20 AM Windows Forms 5
loading
Tags: GridControl
Karl-Michael Beck
Asked On August 12, 2009 09:54 AM

HEllo,

i want to know whats under a certain location of the mouse pointer for a (windows forms) gridgroupingcontrol.

I expect to get detailed information, like
- which row
- which colummn
- columnheader?
- datacell?
- rowheader?
- GroupBy-Panel
- CellButton
etc.

Do you provide such information?

Thanks,
Karl-Michael

Jisha Joy [Syncfusion]
Replied On August 13, 2009 07:54 AM

Hi Karl-Michael,

In the event handler like TableControlCellMouseHoverEnter, it is easy to get the GridTableCellStyleInfo at the point. Once you have the GridTableStyleInfo object, you know a lot about the cell. See the code:

private void gridGroupingControl1_TableControlCellMouseHoverEnter(object sender, GridTableControlCellMouseEventArgs e)
{
//Point pt = e.TableControl.PointToClient(Control.MousePosition);
Point pt = this.groupingGrid1.TableControl.PointToClient(Control.MousePosition);
GridTableCellStyleInfo style = this.groupingGrid1.PointToTableCellStyle(pt);
if(style.TableCellIdentity.Column != null)
{
Console.WriteLine("colName:{0} row rect:{1}", style.TableCellIdentity.Column.Name, this.groupingGrid1.ElementToRectangle(style.TableCellIdentity.DisplayElement));
}
}

Please let me know if this helps.

Regards,
Jisha

Karl-Michael Beck
Replied On August 14, 2009 05:03 AM

Hi Jisha,

thanks a lot. I guess I'll step ahead a bit with this.

But i guess it will need some more code to obtain such information like
IsDataCell
IsNewRecord
IsUnboundCell
IsRowHeader
IsColumnHeader
IsGroupingHeader
IsGroupingFooter
' etc

This is a general criticism at your components: They object models are very huge and complicated. The standard use case is only to obtain with lots of code. i think some facades would be good.

2 more Issues i have:

1. Somehow i got the grid into a mode where it shows buttons for detail records but when i press it it won't open. i need to check what calls lead to this and if it makes sense. However, in this state it happens that the Grid_TableControlCellMouseHoverEnter is entered while the mouselocation is outside the control. calling PointToTableCellStyle with this argument causes an nullreferenceexception. so had to to add a check for this case. i'm not sure if these 2 behaviours is intended. for me at the first sight it looks like a bug.

2. In respect of concurency i'd find it better to use the GridTableControlCellMouseEventArgs.Inner.MouseEventArgs. Maybe the error in 1. would not occur with this. But this object is nothing.

Thank you,
Karl-Michael

Jisha Joy [Syncfusion]
Replied On August 17, 2009 05:27 AM

Hi Karl,

You could get details about different elements in the grid by accessing the TableCellIdentity.DisplayElement of GridTableCellStyleInfo's object. See the code:

void grid_TableControlCellMouseHoverEnter(object sender, GridTableControlCellMouseEventArgs e)
{
//Point pt = e.TableControl.PointToClient(Control.MousePosition);
Point pt = this.grid.TableControl.PointToClient(Control.MousePosition);
GridTableCellStyleInfo style = this.grid.TableControl.PointToTableCellStyle(pt);
if (style.TableCellIdentity.Column != null)
{
Console.WriteLine(" Display Element:{0}", style.TableCellIdentity.DisplayElement);
}

}

Issue 2& 3: I could not able to see the issue mentioned. Could you please provide a sample that shows the issue or reproduce the issue in the following browser sample:
..\My Documents\syncfusion\essentialstudio\7.3.0.20\Windows\Grid.Grouping.Windows\Samples\2.0\Relations And Hierarchy\Related Master Details Demo\cs

Please let me know if you have any questions.

Regards,
Jisha

Karl-Michael Beck
Replied On August 25, 2009 06:40 AM

Hi Jisha,

i didn'T forget you it's just that i'm currently busy with other issues i'll come back to you when i'm finished.

Thanks for your help,
Karl-Michael

Rajadurai C [Syncfusion]
Replied On September 7, 2009 02:20 AM

Hi Karl,

Thanks for your update.

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.

Warning Icon 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.Close Icon

;