Edit AdvStringGrid cell, use oneself write a soft keyboard loses focus, the concrete operation use soft keyboard input a number and then click again on the soft keyboard, is currently editing the cell to lose focus into editing completion status, at this time to loosen soft keyboard (will send an event event type a character) will cover the content of the input before, cause the effect is to use the soft keyboard can only enter one character at a time, forever will cover each input before, could you tell me how to solve, the soft keyboard is oneself write a separate form, key response code below
void __fastcall TfrmKbd: : SpeedButton8Click (TObject * Sender)
{
: : SetFocus (FormHdl);//FormHdl is where the grid is a handle to the window
String STR=((TButton *) Sender) - & gt; Hint.
If (STR=="_")
{
//SendMessage (FormHdl, WM_KEYDOWN, VK_BACK, NULL);
Keybd_event (8, 0, 0, 0).//the Backspace key
KEYEVENTF_KEYUP keybd_event (8, 0, 0).
}
Else if (STR=="& lt;" | | STR=="& gt;" | | STR=="*" | | STR=="+")
{
Char curChar=STR. C_str () [0].
Keybd_event,0,0,0 (16);//by pressing the Shift key
Keybd_event (VkKeyScan (curChar), 0, 0, 0).
Keybd_event (VkKeyScan (curChar), 0, KEYEVENTF_KEYUP, 0).
Keybd_event (KEYEVENTF_KEYUP 16, 0, 0);//release the Shift key
}
The else
{
//SendMessage (FormHdl WM_KEYDOWN, (WPARAM) * (STR) c_str ()), NULL);
Char curChar=STR. C_str () [0].
If (flag==0 & amp; & (((int) curChar & gt;=65 & amp; & (int) curChar & lt;=90) | | ((int) curChar & gt;=97 & amp; & (int) curChar & lt;=122)))//the current pressing shift for capital needs
{
Keybd_event,0,0,0 (16);//by pressing the Shift key
}
Keybd_event (VkKeyScan (curChar), 0, 0, 0).
Keybd_event (VkKeyScan (curChar), 0, KEYEVENTF_KEYUP, 0).
If (flag==0 & amp; & (((int) curChar & gt;=65 & amp; & (int) curChar & lt;=90) | | ((int) curChar & gt;=97 & amp; & (int) curChar & lt;=122)))
{
Keybd_event (KEYEVENTF_KEYUP 16, 0, 0);//release the Shift key
}
}
: : SetFocus (FormHdl);
}