Issue with the PointToTableCellStyle
Hello,
You have demonstrated the usage of the PointToTableCellStyle method in the following threads:
http://www.syncfusion.com/Support/forums/message.aspx?MessageID=56020
http://www.syncfusion.com/support/forums/message.aspx?MessageID=56017
We used this method, but we faced a problem: The method can return incorrect data in some cases. To reproduce it, insert the following code:
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X,e.Inner.Y));
if( style != null )
{
Element el = style.TableCellIdentity.DisplayElement;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
MessageBox.Show("Column = " + style.TableCellIdentity.Column.HeaderText);
}
}
}
in the EmployeeTerritoryOrder sample application located in the '\Essential Studio\x.x.x.x\Windows\Grid.Grouping.Windows\Samples\FeatureSamples\EmployeeTerritoryOrder\' folder. Run the application and try to click cells 'Seattle' and '98122' near the right border of the cells. You will see that the column referred to by the information returned by the PointToTableCellStyle method is wrong. Please see the attached image.
Best Regards,
David
PointToTableCellStyle.zip
You have demonstrated the usage of the PointToTableCellStyle method in the following threads:
http://www.syncfusion.com/Support/forums/message.aspx?MessageID=56020
http://www.syncfusion.com/support/forums/message.aspx?MessageID=56017
We used this method, but we faced a problem: The method can return incorrect data in some cases. To reproduce it, insert the following code:
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X,e.Inner.Y));
if( style != null )
{
Element el = style.TableCellIdentity.DisplayElement;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
MessageBox.Show("Column = " + style.TableCellIdentity.Column.HeaderText);
}
}
}
in the EmployeeTerritoryOrder sample application located in the '
Best Regards,
David
PointToTableCellStyle.zip
SIGN IN To post a reply.
5 Replies
RA
Rajagopal
Syncfusion Team
August 3, 2007 04:03 PM UTC
Hi David,
Thanks for your interest in Syncfusion Products.
Please try the modified code below for the TableControlMouseDown event handler that works fine in returning the correct column that is clicked.
Let me know if this helps.
Have a nice time.
Regards,
Rajagopal
Thanks for your interest in Syncfusion Products.
Please try the modified code below for the TableControlMouseDown event handler that works fine in returning the correct column that is clicked.
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
int row, col;
if (e.TableControl.PointToRowCol(pt, out row, out col))
{
GridTableCellStyleInfo styleInfo = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(row, col);
MessageBox.Show("Column: " + styleInfo.TableCellIdentity.Column.HeaderText);
}
}
Let me know if this helps.
Have a nice time.
Regards,
Rajagopal
AL
Alex
August 9, 2007 07:24 PM UTC
Hello Rajagopal,
Thank you for your help.
However, this code only works for the main table and does not work for child tables.
For styleInfo.TableCellIdentity.TableCellType, it returns Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.EmptyCell
To reproduce the problem, you need to click the header of the Territory column in this sample:
\Essential Studio\x.x.x.x\Windows\Grid.Grouping.Windows\Samples\FeatureSamples\EmployeeTerritoryOrder\
Is there a way to get the correct result for both the main table and child tables?
Best Regards,
David
Thank you for your help.
However, this code only works for the main table and does not work for child tables.
For styleInfo.TableCellIdentity.TableCellType, it returns Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.EmptyCell
To reproduce the problem, you need to click the header of the Territory column in this sample:
Is there a way to get the correct result for both the main table and child tables?
Best Regards,
David
AL
Alex
August 23, 2007 06:09 PM UTC
Hello Rajagopal,
Any ideas?
Best Regards,
David
Any ideas?
Best Regards,
David
RA
Rajagopal
Syncfusion Team
August 24, 2007 03:37 AM UTC
Hi David,
We apologize for the delay in getting back to you.
Please try the modified code below that works fine for both main table and child tables.
Let me know if you have any other questions.
Have a nice time.
Regards,
Rajagopal
We apologize for the delay in getting back to you.
Please try the modified code below that works fine for both main table and child tables.
void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(pt);
GridTableDescriptor td = style.TableCellIdentity.Table.TableDescriptor;
if (td.Name == "Employees")
{
int row, col;
if (e.TableControl.PointToRowCol(pt, out row, out col))
{
GridTableCellStyleInfo styleInfo = (GridTableCellStyleInfo) e.TableControl.GetTableViewStyleInfo(row, col);
MessageBox.Show("Column: " + styleInfo.TableCellIdentity.Column.HeaderText);
}
}
else if (td.Name == "EmployeeTerritories" || td.Name == "Orders" )
{
MessageBox.Show("Column = " + style.TableCellIdentity.Column.HeaderText);
}
}
Let me know if you have any other questions.
Have a nice time.
Regards,
Rajagopal
AL
Alex
August 24, 2007 01:02 PM UTC
Hi Rajagopal,
Thank you for your help. We will analyze the solution you suggested, and I will write here if we have any questions.
Best Regards,
David
Thank you for your help. We will analyze the solution you suggested, and I will write here if we have any questions.
Best Regards,
David
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
AL Alex
- Aug 1, 2007 01:01 PM UTC
- Aug 24, 2007 01:02 PM UTC