1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00

Show and hide browser tabs in FMXTabbedOSRBrowser

This commit is contained in:
salvadordf 2022-04-11 11:49:01 +02:00
parent ad44231235
commit c99a44aab2
4 changed files with 42 additions and 3 deletions

View File

@ -143,6 +143,8 @@ type
procedure NotifyMoveOrResizeStarted;
procedure SendCaptureLostEvent;
procedure ShowBrowser;
procedure HideBrowser;
{$IFDEF MSWINDOWS}
procedure HandleSYSCHAR(const aMessage : TMsg);
procedure HandleSYSKEYDOWN(const aMessage : TMsg);
@ -252,6 +254,17 @@ begin
FMXChromium1.SendCaptureLostEvent;
end;
procedure TBrowserFrame.ShowBrowser;
begin
FMXChromium1.WasHidden(False);
FMXChromium1.SetFocus(True);
end;
procedure TBrowserFrame.HideBrowser;
begin
FMXChromium1.SetFocus(False);
FMXChromium1.WasHidden(True);
end;
procedure TBrowserFrame.StopBtnClick(Sender: TObject);
begin

View File

@ -65,6 +65,8 @@ type
procedure CloseBrowser;
procedure ResizeBrowser;
procedure FocusBrowser;
procedure ShowBrowser;
procedure HideBrowser;
procedure SendCaptureLostEvent;
{$IFDEF MSWINDOWS}
procedure HandleSYSCHAR(const aMessage : TMsg);
@ -151,6 +153,16 @@ begin
if (FBrowserFrame <> nil) then FBrowserFrame.FocusBrowser;
end;
procedure TBrowserTab.ShowBrowser;
begin
if (FBrowserFrame <> nil) then FBrowserFrame.ShowBrowser;
end;
procedure TBrowserTab.HideBrowser;
begin
if (FBrowserFrame <> nil) then FBrowserFrame.HideBrowser;
end;
procedure TBrowserTab.BrowserFrame_OnBrowserDestroyed(Sender: TObject);
begin
// This event is executed in a CEF thread so we have to send a message to

View File

@ -369,9 +369,23 @@ begin
end;
procedure TMainForm.BrowserTabCtrlChange(Sender: TObject);
var
i : integer;
TempTab : TBrowserTab;
begin
if (BrowserTabCtrl.ActiveTab <> nil) then
TBrowserTab(BrowserTabCtrl.ActiveTab).FocusBrowser;
i := pred(BrowserTabCtrl.TabCount);
while (i >= 0) do
begin
TempTab := TBrowserTab(BrowserTabCtrl.Tabs[i]);
if (BrowserTabCtrl.TabIndex = i) then
TempTab.ShowBrowser
else
TempTab.HideBrowser;
dec(i);
end;
end;
function TMainForm.CloseAllTabs : boolean;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 381,
"InternalVersion" : 382,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "100.0.14.0"
}