S
Susanne Christe
Hi Folks,
I'm trying to override protected ProcessCmdKey function in writing my a
custom MyDataGrid.
I get the Keys I want, but it takes no effect to MyDataGrid, if I try
for example execute myDataGrid.Select(rowNum);
MessageBox.Show is coming up, but this takes no effect on Select or Focus.
Anybody knows why?
Here is the Code:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
int rowIndex = this.CurrentRowIndex;
CManagerMain mainForm = (CManagerMain) this.Parent.FindForm();
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch(keyData)
{
case Keys.Down:
MessageBox.Show("Box goes up");
this.Select(rowIndex );
break;
case Keys.Up:
MessageBox.Show("Box goes up");
this.Select(rowIndex );
break;
case Keys.Tab:
MessageBox.Show("Box goes up");
mainForm.myTextBox.Focus();
break;
}
}
return base.ProcessCmdKey(ref msg,keyData);
}
Thx in advance
I'm trying to override protected ProcessCmdKey function in writing my a
custom MyDataGrid.
I get the Keys I want, but it takes no effect to MyDataGrid, if I try
for example execute myDataGrid.Select(rowNum);
MessageBox.Show is coming up, but this takes no effect on Select or Focus.
Anybody knows why?
Here is the Code:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
int rowIndex = this.CurrentRowIndex;
CManagerMain mainForm = (CManagerMain) this.Parent.FindForm();
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch(keyData)
{
case Keys.Down:
MessageBox.Show("Box goes up");
this.Select(rowIndex );
break;
case Keys.Up:
MessageBox.Show("Box goes up");
this.Select(rowIndex );
break;
case Keys.Tab:
MessageBox.Show("Box goes up");
mainForm.myTextBox.Focus();
break;
}
}
return base.ProcessCmdKey(ref msg,keyData);
}
Thx in advance