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

HitTest

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

5 Replies

JJ Jisha Joy Syncfusion Team August 13, 2009 11:54 AM UTC

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


KB Karl-Michael Beck August 14, 2009 09:03 AM UTC

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


JJ Jisha Joy Syncfusion Team August 17, 2009 09:27 AM UTC

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


KB Karl-Michael Beck August 25, 2009 10:40 AM UTC

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


RC Rajadurai C Syncfusion Team September 7, 2009 06:20 AM UTC

Hi Karl,

Thanks for your update.

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon