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
OnMouseWheel = Panel1MouseWheel
OnKeyDown = Panel1KeyDown
OnDialogKey = Panel1DialogKey
end
object chrmosr: TFMXChromium
OnTooltip = chrmosrTooltip

View File

@ -79,6 +79,7 @@ type
procedure Panel1MouseLeave(Sender: TObject);
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
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 FormDestroy(Sender: TObject);
@ -317,6 +318,12 @@ begin
Panel1.SetFocus;
end;
procedure TFMXExternalPumpBrowserFrm.Panel1DialogKey(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if (Key = vkTab) then Key := 0;
end;
procedure TFMXExternalPumpBrowserFrm.Panel1Enter(Sender: TObject);
begin
chrmosr.SendFocusEvent(True);
@ -351,7 +358,7 @@ begin
end
else
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;
end;
@ -978,7 +985,7 @@ var
begin
if Panel1.IsFocused then
begin
if (aMessage.wParam = VK_RETURN) then
if (aMessage.wParam = vkReturn) then
begin
TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);

View File

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

View File

@ -82,6 +82,7 @@ type
procedure FMXBufferPanel1MouseLeave(Sender: TObject);
procedure FMXBufferPanel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
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 FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
@ -265,6 +266,12 @@ begin
FocusBrowser;
end;
procedure TBrowserFrame.FMXBufferPanel1DialogKey(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = vkTab) then Key := 0;
end;
procedure TBrowserFrame.FMXBufferPanel1Enter(Sender: TObject);
begin
FMXChromium1.SendFocusEvent(True);
@ -297,7 +304,7 @@ begin
end
else
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;
end;
@ -1069,7 +1076,7 @@ var
begin
if FMXBufferPanel1.IsFocused then
begin
if (aMessage.wParam = VK_RETURN) then
if (aMessage.wParam = vkReturn) then
begin
TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);

View File

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