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.

Issue with the PointToTableCellStyle

Thread ID:

Created:

Updated:

Platform:

Replies:

66703 Aug 1,2007 09:01 AM Aug 24,2007 09:02 AM Windows Forms 5
loading
Tags: Tools
Alex
Asked On August 1, 2007 09:01 AM

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

Rajagopal [Syncfusion]
Replied On August 3, 2007 12:03 PM

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.

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

Alex
Replied On August 9, 2007 03:24 PM

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

Alex
Replied On August 23, 2007 02:09 PM

Hello Rajagopal,

Any ideas?

Best Regards,
David

Rajagopal [Syncfusion]
Replied On August 23, 2007 11:37 PM

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.

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

Alex
Replied On August 24, 2007 09:02 AM

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

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.

;