| | | | Browse by category |
I'm trying to tab to an OG control on a form, that contains embedded .NET controls, but it never receives focus. I have the TabStop property set to true for the OG control and the TabOrder is set properly as well. However, it seems like, that using the tab key the OG control only receives focus if I already clicked on a cell with the mouse. And even then, it's not the OG control that receives focus but the embedded control belonging to the previously clicked cell.
Cause
Action
In our 1stgrid sample, add a few controls on a form with Grid, say a button (TabInd =1), an edit (2) and a checkbox (4), then try following workaround:
private bool bTabtoGrid = false;
this.gridControl1.ProcessKeys += new Stingray.Grid.ProcessKeysEventHandler(this.gridControl1_ProcessKeys);
protected override System.Boolean ProcessCmdKey (ref Message m ,
Keys keyData )
{
if(keyData == Keys.Tab)
{
if(this.GetNextControl(Control.FromHandle(m.HWnd),true)
== gridControl1)
{
bTabtoGrid = true;
return gridControl1.Focus();
}
}
return base.ProcessCmdKey(ref m, keyData);
}
private void gridControl1_ProcessKeys(object sender, Stingray.Grid.ProcessKeysEventArgs e)
{
if(e.Char == 9 && !bTabtoGrid)
{
GetNextControl(gridControl1,true).Focus();
e.Handled = true;
}
else if (bTabtoGrid)
bTabtoGrid = false;
}