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.

Preventing the focus rectangle from moving to the adjacent CaptionCell when I click the plusminus arrow

Thread ID:

Created:

Updated:

Platform:

Replies:

60925 May 15,2007 11:04 AM May 17,2007 05:09 PM Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On May 15, 2007 11:04 AM

Everytime that I click the plus/minus arrow, the focus rectangle moves to the adjacent caption summary cell. How can I prevent this?

Clicking on the plus minus cell shouldn't move focus to the adjancent caption summary cell becuase that would suggest it was the record that the user clicked on or used the arrow key to navigate to. If I disabled the caption summary text to prevent this, then I run into the other problem of that cell NOT having the focus rectangle when the user click on it.

Please help.


Rajagopal [Syncfusion]
Replied On May 16, 2007 05:18 PM

Hi James,

To avoid this from happening, please try the code below in the TableControlDrawCurrentCellBorder event handler of the GridGroupingControl.

void gridGroupingControl1_TableControlDrawCurrentCellBorder(object sender, GridTableControlDrawCurrentCellBorderEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell ||
style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
{
e.Inner.Cancel = true;
}
}

Let us know if you have any further questions.
Regards,
Rajagopal

James Blibo
Replied On May 16, 2007 11:10 PM

How does this snippet solve my problem?

My question was -> when I click the PlusMinusCaption cell to expand or collaspe a group, the ggc is automatically selecting the the first CaptionSummary cell. I do not want that to happen. I have a flat datasource which is group by one field.

The solution you provided simply prevent all cells in the Caption summary row from showing the focus rectangle. This is not what I desire.

Rajagopal [Syncfusion]
Replied On May 17, 2007 05:09 PM

Hi James,

Sorry for the inconvenience. Please try the code below in the TableControlMouseDown and TableControlDrawCurrentCellBorder respectively. This will help you in achieving the desired behavior.

bool flag = false;
void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
GridTableCellStyleInfo styleInfo = e.TableControl.PointToTableCellStyle(pt);
if (styleInfo.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
flag = true;
else
flag = false;
}

void gridGroupingControl1_TableControlDrawCurrentCellBorder(object sender, GridTableControlDrawCurrentCellBorderEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell ||
style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell && flag)
{
e.Inner.Cancel = true;
}
}

Let us know if you have any other questions.
Rajagopal

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.

;