I'm working with GDBG 4.4.0.51
I'm working with an onscreen keyboard, that is button based, and I want to simulate a key press into the grid.
Since the keyboard is button based, they steal the focus from the grid. The solution that I found was to raise an event from the onscreen keyboard into the grid, and in the grid to do something like this :
void Keyboard_KeyPressed(char key)
{
Message msg = new Message();
msg.Msg = 0x102;
msg.WParam = (IntPtr) key;
bool handled = CurrentCell.Renderer.RaiseProcessKeyEventArgs(ref msg);
if (handled == false)
{
CurrentCell.Renderer.ControlText += key;
}
}
However, that's quite a nasty bypass, and it doesn't work completely like a regular keypress (for example, column text shows as wrapped in narrow columns when the user presses a key, but not from the keyboard).
Is there standard way to do something like this ?
HA
haneefm
Syncfusion Team
April 18, 2007 03:58 PM UTC
Hi Miki,
Try calling the RaiseCurrentCellControlKeyMessage method to raise key event in a grid. Here is a code snippet
this.gridDataBoundGrid1.RaiseCurrentCellControlKeyMessage( gcem);
Best regards,
Haneef
MW
Miki Watts
April 18, 2007 04:08 PM UTC
nope, sorry, it doesn't raise the keypress event now.
AD
Administrator
Syncfusion Team
April 18, 2007 07:14 PM UTC
Just something to try. Comment out the code in your current Keyboard_KeyPressed. Instead, call grid.Focus() and the SendKeys.Send to pass the key onto the grid. After the SendKeys.Send call, you might need to set the focus back to the keyboard control.