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.

TableControlMouseDown row changed

Thread ID:

Created:

Updated:

Platform:

Replies:

70988 Jan 10,2008 05:41 PM Jan 11,2008 11:55 PM Windows Forms 4
loading
Tags: Grouping
Natalija Ilic
Asked On January 10, 2008 05:41 PM

How I can determine that user clicked on deferent row in TableControlMouseDown event?
Thanks


haneefm [Syncfusion]
Replied On January 10, 2008 06:20 PM

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


Natalija Ilic
Replied On January 10, 2008 07:14 PM

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




Natalija Ilic
Replied On January 11, 2008 01:21 PM

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


Jisha Joy [Syncfusion]
Replied On January 11, 2008 11:55 PM

Hi Natalija,

Thank you for your update.
Glad to hear that issue has been solved
Regards,
Jisha



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.

;