Browse Source

#232 remove hack and avoid ProcessMessages

Juliette ELSASS 7 months ago
parent
commit
1c3d406e26
2 changed files with 12 additions and 45 deletions
  1. 3 18
      bckeyboard.pas
  2. 9 27
      bcnumerickeyboard.pas

+ 3 - 18
bckeyboard.pas

@@ -171,31 +171,16 @@ begin
   end
   end
   else if str = F_back.Caption then
   else if str = F_back.Caption then
   begin
   begin
-    {$IFDEF CPUX86_64}
-    Application.ProcessMessages;
-    KeyInput.Press(VK_BACK);
-    Application.ProcessMessages;
+    {$IFDEF FPC}
+    Application.QueueAsyncCall(PressVirtKey, VK_BACK);
     {$ELSE}
     {$ELSE}
-      {$IFDEF FPC}
-      Application.QueueAsyncCall(PressVirtKey, VK_BACK);
-      {$ELSE}
-      SendKey(VK_BACK);
-      {$ENDIF}
+    SendKey(VK_BACK);
     {$ENDIF}
     {$ENDIF}
   end
   end
   else
   else
   begin
   begin
     if str = F_space.Caption then
     if str = F_space.Caption then
       str := ' ';
       str := ' ';
-    {$IFDEF CPUX86_64}
-    Application.ProcessMessages;
-    if F_shift.Down then
-      KeyInput.Down(VK_SHIFT);
-    KeyInput.Press(Ord(UpperCase(str)[1]));
-    if F_shift.Down then
-      KeyInput.Up(VK_SHIFT);
-    Application.ProcessMessages;
-    {$ELSE}
     if F_shift.Down then
     if F_shift.Down then
       {$IFDEF FPC}
       {$IFDEF FPC}
       Application.QueueAsyncCall(PressShiftVirtKey, Ord(UpperCase(str)[1]))
       Application.QueueAsyncCall(PressShiftVirtKey, Ord(UpperCase(str)[1]))

+ 9 - 27
bcnumerickeyboard.pas

@@ -121,44 +121,26 @@ begin
 
 
   if num = FBtnClr.Caption then
   if num = FBtnClr.Caption then
   begin
   begin
-    {$IFDEF CPUX86_64}
-    Application.ProcessMessages;
-    KeyInput.Press(VK_BACK);
-    Application.ProcessMessages;
+    {$IFDEF FPC}
+    Application.QueueAsyncCall(PressVirtKey, VK_BACK);
     {$ELSE}
     {$ELSE}
-      {$IFDEF FPC}
-      Application.QueueAsyncCall(PressVirtKey, VK_BACK);
-      {$ELSE}
-      SendKey(VK_BACK);
-      {$ENDIF}
+    SendKey(VK_BACK);
     {$ENDIF}
     {$ENDIF}
   end
   end
   else if num = FBtnDot.Caption then
   else if num = FBtnDot.Caption then
   begin
   begin
-    {$IFDEF CPUX86_64}
-    Application.ProcessMessages;
-    KeyInput.Press(vk_DotNumPad);
-    Application.ProcessMessages;
+    {$IFDEF FPC}
+    Application.QueueAsyncCall(PressVirtKey, vk_DotNumPad);
     {$ELSE}
     {$ELSE}
-      {$IFDEF FPC}
-      Application.QueueAsyncCall(PressVirtKey, vk_DotNumPad);
-      {$ELSE}
-      SendKey(vk_DotNumPad);
-      {$ENDIF}
+    SendKey(vk_DotNumPad);
     {$ENDIF}
     {$ENDIF}
   end
   end
   else
   else
   begin
   begin
-    {$IFDEF CPUX86_64}
-    Application.ProcessMessages;
-    KeyInput.Press(Ord(TBCButton(Sender).Caption[1]));
-    Application.ProcessMessages;
+    {$IFDEF FPC}
+    Application.QueueAsyncCall(PressVirtKey, Ord(TBCButton(Sender).Caption[1]));
     {$ELSE}
     {$ELSE}
-      {$IFDEF FPC}
-      Application.QueueAsyncCall(PressVirtKey, Ord(TBCButton(Sender).Caption[1]));
-      {$ELSE}
-      SendKey(Ord(TBCButton(Sender).Caption[1]));
-      {$ENDIF}
+    SendKey(Ord(TBCButton(Sender).Caption[1]));
     {$ENDIF}
     {$ENDIF}
   end;
   end;