Fix TAB key handling in FMX demos in OSR mode

This commit is contained in:
Salvador Díaz Fau 2020-04-25 16:26:49 +02:00
parent a34ae44cb0
commit 17c82fa24c
5 changed files with 21 additions and 5 deletions

View File

@ -102,6 +102,7 @@ object FMXExternalPumpBrowserFrm: TFMXExternalPumpBrowserFrm
OnMouseLeave = Panel1MouseLeave OnMouseLeave = Panel1MouseLeave
OnMouseWheel = Panel1MouseWheel OnMouseWheel = Panel1MouseWheel
OnKeyDown = Panel1KeyDown OnKeyDown = Panel1KeyDown
OnDialogKey = Panel1DialogKey
end end
object chrmosr: TFMXChromium object chrmosr: TFMXChromium
OnTooltip = chrmosrTooltip OnTooltip = chrmosrTooltip

View File

@ -79,6 +79,7 @@ type
procedure Panel1MouseLeave(Sender: TObject); procedure Panel1MouseLeave(Sender: TObject);
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
procedure Panel1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); procedure Panel1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure Panel1DialogKey(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@ -317,6 +318,12 @@ begin
Panel1.SetFocus; Panel1.SetFocus;
end; end;
procedure TFMXExternalPumpBrowserFrm.Panel1DialogKey(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if (Key = vkTab) then Key := 0;
end;
procedure TFMXExternalPumpBrowserFrm.Panel1Enter(Sender: TObject); procedure TFMXExternalPumpBrowserFrm.Panel1Enter(Sender: TObject);
begin begin
chrmosr.SendFocusEvent(True); chrmosr.SendFocusEvent(True);
@ -351,7 +358,7 @@ begin
end end
else else
if (Key <> 0) and (KeyChar = #0) and if (Key <> 0) and (KeyChar = #0) and
(Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then (Key in [vkLeft, vkRight, vkUp, vkDown]) then
Key := 0; Key := 0;
end; end;
@ -978,7 +985,7 @@ var
begin begin
if Panel1.IsFocused then if Panel1.IsFocused then
begin begin
if (aMessage.wParam = VK_RETURN) then if (aMessage.wParam = vkReturn) then
begin begin
TempKeyEvent.kind := KEYEVENT_CHAR; TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);

View File

@ -126,6 +126,7 @@ object BrowserFrame: TBrowserFrame
OnMouseLeave = FMXBufferPanel1MouseLeave OnMouseLeave = FMXBufferPanel1MouseLeave
OnMouseWheel = FMXBufferPanel1MouseWheel OnMouseWheel = FMXBufferPanel1MouseWheel
OnKeyDown = FMXBufferPanel1KeyDown OnKeyDown = FMXBufferPanel1KeyDown
OnDialogKey = FMXBufferPanel1DialogKey
end end
object FMXChromium1: TFMXChromium object FMXChromium1: TFMXChromium
OnLoadError = FMXChromium1LoadError OnLoadError = FMXChromium1LoadError

View File

@ -82,6 +82,7 @@ type
procedure FMXBufferPanel1MouseLeave(Sender: TObject); procedure FMXBufferPanel1MouseLeave(Sender: TObject);
procedure FMXBufferPanel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); procedure FMXBufferPanel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
procedure FMXBufferPanel1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); procedure FMXBufferPanel1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure FMXBufferPanel1DialogKey(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FMXChromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); procedure FMXChromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
procedure FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); procedure FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
@ -265,6 +266,12 @@ begin
FocusBrowser; FocusBrowser;
end; end;
procedure TBrowserFrame.FMXBufferPanel1DialogKey(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = vkTab) then Key := 0;
end;
procedure TBrowserFrame.FMXBufferPanel1Enter(Sender: TObject); procedure TBrowserFrame.FMXBufferPanel1Enter(Sender: TObject);
begin begin
FMXChromium1.SendFocusEvent(True); FMXChromium1.SendFocusEvent(True);
@ -297,7 +304,7 @@ begin
end end
else else
if (Key <> 0) and (KeyChar = #0) and if (Key <> 0) and (KeyChar = #0) and
(Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then (Key in [vkLeft, vkRight, vkUp, vkDown]) then
Key := 0; Key := 0;
end; end;
@ -1069,7 +1076,7 @@ var
begin begin
if FMXBufferPanel1.IsFocused then if FMXBufferPanel1.IsFocused then
begin begin
if (aMessage.wParam = VK_RETURN) then if (aMessage.wParam = vkReturn) then
begin begin
TempKeyEvent.kind := KEYEVENT_CHAR; TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 125, "InternalVersion" : 126,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "81.2.24.0" "Version" : "81.2.24.0"
} }