HA
haneefm
Syncfusion Team
January 10, 2008 11:20 PM UTC
Hi Natalija,
In TableControlMouseDown event handler, you can get the GridTableCellStyleInfo at the point using the PointToTableCellStyle method. Once you have the GridTableStyleInfo object, you can easily get the display element of the GridTableStyleInfo. Below are the codes:
private void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArg e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if (style != null)
{
Element el = style.TableCellIdentity.DisplayElement;
Console.WriteLine(el);
}
}
Best regards,
Haneef
NI
Natalija Ilic
January 11, 2008 12:14 AM UTC
But with what I need to compare this Element?
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if (style != null)
{
Element el = style.TableCellIdentity.DisplayElement;
Element curr = GridGroupingControl.Table.CurrentElement;
if (this.rowDirty
&& e.TableControl.CurrentCell != null && !el.Equals(curr))
{
e.TableControl.Table.EndEdit();
e.TableControl.CurrentCell.MoveDown();
}
}
If I compare with Element curr = GridGroupingControl.Table.CurrentElement they are deferent even if I am on the same row. I want to execute e.TableControl.Table.EndEdit();
e.TableControl.CurrentCell.MoveDown();
only if I change the row with mouse click.
Thank you
>Hi Natalija,
In TableControlMouseDown event handler, you can get the GridTableCellStyleInfo at the point using the PointToTableCellStyle method. Once you have the GridTableStyleInfo object, you can easily get the display element of the GridTableStyleInfo. Below are the codes:
private void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArg e)
{
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if (style != null)
{
Element el = style.TableCellIdentity.DisplayElement;
Console.WriteLine(el);
}
}
Best regards,
Haneef
NI
Natalija Ilic
January 11, 2008 06:21 PM UTC
It's OK, I figure it out. I should compare Record.
GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if (style != null)
{
Element el = style.TableCellIdentity.DisplayElement;
Element curr = gdInvoiceMatching.Table.CurrentElement;
Record elRec = el.GetRecord();
Record currRec = curr.GetRecord();
if (e.TableControl.CurrentCell != null && elRec != null && !elRec.Equals(currRec))
{
e.TableControl.Table.EndEdit();
e.TableControl.CurrentCell.MoveDown();
}
}
Thanks again
JJ
Jisha Joy
Syncfusion Team
January 12, 2008 04:55 AM UTC
Hi Natalija,
Thank you for your update.
Glad to hear that issue has been solved
Regards,
Jisha