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. Image for the cookie policy date
close icon

Problems with Tab Order

I have been trying to work through the following tab order issue without success.

I have a grid with randomly spaced editable cells. I would like the tab key to be able to work through the editable fields in the standard row, column order. For some reason, the grid control seems to be grouping the cells. So the tab key will work consistantly through a subset of the cells. If I put the cursor in one of the unaccessed cells, it will cycle through a different subset of cells.

I finally broke down and tried it in a test program and I still saw the problem. I have attached that project. You will notice that D2 and H2 function as one group, the cells in rows 3 - 6 function as a second group and the cells in rows 7 - 10 function as a third group.

Am I missing something in my code or is there an issue here?

Syncfusion 5.1, VS 2005 (C#)

Thanks for the help,
Tom Murphy

WindowsApplication185.zip

3 Replies

HA haneefm Syncfusion Team May 26, 2007 12:09 AM UTC

Hi TJM,

You can get the Tab key using the CurrentCellKeyDown event and then check that Tab key in a QueryNextCurrentCellPosition event for moving the currentcell at required position in a Grid. Below is a forum thread that handle the QueryNextCurrentCellPosition event.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=60609

Best regards,
Haneef


TJ TJM May 29, 2007 02:02 PM UTC

Haneef:

Thanks for the reference to the forum describing the handling of the Tab and Enter keys.

I have implemented the code in that example in my test application and I am still seeing the problem. I tested with both the Tab key and the Enter key.

The editable cells seem to still be handled as multiple sets. In addition to setting the WrapCellBehavior to WrapRow, I am also setting WantTabKey and WantEnterKey to true.

I have attached a copy of the test application I am using.

Thanks,
Tom Murphy

WindowsApplication237.zip


HA haneefm Syncfusion Team May 29, 2007 10:59 PM UTC

Hi TJM,

You can handle the CurrentCellKeyUp event to detect the EnterKey for moving current cell to next enabled cell in a grid. And you can detect LastColIndex from the CurrentCellKeyDown event. Here is a code snippet.

int LastColIndex = -1;
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
LastColIndex = cc.ColIndex;
}
}

void gridControl1_CurrentCellKeyUp(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( LastColIndex == cc.ColIndex )
{
int row = cc.RowIndex, col = cc.ColIndex + 1;
if (!grid.Model[row, col].Enabled)
{
for (int i = row; i <= grid.RowCount; i++)
{
row = i;
cc.QueryNextEnabledCell(GridDirectionType.Right, ref row, ref col);
if (grid.Model[row, col].Enabled)
break;
col = 1;
}
cc.MoveTo(row, col);
cc.ScrollInView();
}
}
}
}

Here is a modified sample for implementation and let me know if this helps.
ModifiedWindowsApplication2.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon