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.

How to I force the LEFT/RIGHT arrow key to skip the plus/minus button.

Thread ID:

Created:

Updated:

Platform:

Replies:

53434 Dec 13,2006 11:44 AM Dec 22,2006 02:09 AM Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On December 13, 2006 11:44 AM

How do I force the LEFT or RIGHT arrow key to skip the plus/minus button.

Administrator [Syncfusion]
Replied On December 14, 2006 08:56 AM

Hi James,

You can skip the GroupCaptionPlusMinus button by handling the TableControlKeyDown event. In the event, you can move CurrentCell accordingly depending on the GroupCaptionPlusMinus. The following is the code snippet

>>>>>>>>>>>>>>>>>>>>>>>>>>
private void gridGroupingControl1_TableControlKeyDown(object sender, GridTableControlKeyEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
if(e.Inner.KeyCode == Keys.Right)
{
GridTableCellStyleInfo info = this.gridGroupingControl1.Table.TableModel[cc.RowIndex,cc.ColIndex];
if (info != null && info.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell) //cs != null ) //&& cs.GroupLevel > 0)
{
e.Inner.Handled = true;
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex+1);
}
}
else if(e.Inner.KeyCode == Keys.Left)
{
GridTableCellStyleInfo info = this.gridGroupingControl1.Table.TableModel[cc.RowIndex,cc.ColIndex];
if (info != null && info.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell) //cs != null ) //&& cs.GroupLevel > 0)
{
e.Inner.Handled = true;
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex-1);
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>

In case, if you need to avoid expand and collapse of group on Right arrow key. You can use the following code snippet.

>>>>>>>>>>>>>>>>>>>>>>>>>>
private void gridGroupingControl1_TableControlKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
if(e.Inner.KeyCode == Keys.Up)
{
e.Inner.Handled = true;
if(this.gridGroupingControl1.Table.TableModel.GetDisplayElementAt(cc.RowIndex-1) is CaptionRow)
{
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex-1, cc.ColIndex);
}
}
if(e.Inner.KeyCode == Keys.Down)
{
e.Inner.Handled = true;
if(this.gridGroupingControl1.Table.TableModel.GetDisplayElementAt(cc.RowIndex+1) is CaptionRow)
{
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex+1, cc.ColIndex);
}
}
if(e.Inner.KeyCode == Keys.Right)
{
e.Inner.Handled = true;
CaptionRow cs = this.gridGroupingControl1.Table.TableModel.GetDisplayElementAt(cc.RowIndex) as CaptionRow;
if (cs != null && cs.GroupLevel > 0)
{
Group g = cs.ParentGroup;
if (g.IsExpanded)
{
g.IsExpanded = !g.IsExpanded;
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex+1);
}
}
}
if(e.Inner.KeyCode == Keys.Left)
{
e.Inner.Handled = true;
if(this.gridGroupingControl1.Table.TableModel.GetDisplayElementAt(cc.RowIndex+1) is CaptionRow)
{
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex-1);
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>

Kindly try it and let us know if you need assistance or a demo sample.
Have a nice day.

Best regards,
Madhan

James Blibo
Replied On December 20, 2006 08:25 PM

Both solutions not working...

With the first, when I hit a captionsummary cell , I get stuck in that cell.;

Fir the second, I get stuck in any cell and can't move.

Administrator [Syncfusion]
Replied On December 22, 2006 02:09 AM

Hi James,

Please update us more details or a video clip on your requirement. Is your requirement to avoid the navigation over the caption plus/minus on right or left key navigation or do you need to avoid expand / collapse on right and left key?

The following is the sample using your grid settings which demonstrates the way to avoid expand / collapse caption group on Left/Right key navigation.
GGC_Navigation_22Dec06.zip

Thank you for being patience.
Have a nice day.

Best regards,
Madhan

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.

;