Added tab navigation controls to the FMXTabbedOSRBrowser demo

This commit is contained in:
Salvador Diaz Fau 2021-02-05 17:35:53 +01:00
parent 691986692b
commit 6d5b74070b
3 changed files with 78 additions and 1 deletions

View File

@ -48,6 +48,42 @@ object MainForm: TMainForm
Size.PlatformDefault = False Size.PlatformDefault = False
StyleLookup = 'deleteitembutton' StyleLookup = 'deleteitembutton'
end end
object PrevTabBtn: TSpeedButton
Action = PrevTabAction
Align = Top
Enabled = True
ImageIndex = -1
Position.X = 5.000000000000000000
Position.Y = 54.000000000000000000
Size.Width = 22.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'arrowlefttoolbutton'
end
object NextTabBtn: TSpeedButton
Action = NextTabAction
Align = Top
Enabled = True
ImageIndex = -1
Position.X = 5.000000000000000000
Position.Y = 76.000000000000000000
Size.Width = 22.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'arrowrighttoolbutton'
end
object ShowTabsBtn: TSpeedButton
Action = ShowTabsAction
Align = Top
Enabled = True
ImageIndex = -1
Position.X = 5.000000000000000000
Position.Y = 98.000000000000000000
Size.Width = 22.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'passwordeditbutton'
end
end end
object BrowserTabCtrl: TTabControl object BrowserTabCtrl: TTabControl
Align = Client Align = Client
@ -69,5 +105,17 @@ object MainForm: TMainForm
Text = 'RemoveTabAction' Text = 'RemoveTabAction'
OnExecute = RemoveTabActionExecute OnExecute = RemoveTabActionExecute
end end
object PrevTabAction: TAction
Text = 'PrevTabAction'
OnExecute = PrevTabActionExecute
end
object NextTabAction: TAction
Text = 'NextTabAction'
OnExecute = NextTabActionExecute
end
object ShowTabsAction: TAction
Text = 'ShowTabsAction'
OnExecute = ShowTabsActionExecute
end
end end
end end

View File

@ -66,6 +66,12 @@ type
ActionList1: TActionList; ActionList1: TActionList;
AddTabAction: TAction; AddTabAction: TAction;
RemoveTabAction: TAction; RemoveTabAction: TAction;
PrevTabBtn: TSpeedButton;
NextTabBtn: TSpeedButton;
ShowTabsBtn: TSpeedButton;
PrevTabAction: TAction;
NextTabAction: TAction;
ShowTabsAction: TAction;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
@ -75,6 +81,9 @@ type
procedure AddTabActionExecute(Sender: TObject); procedure AddTabActionExecute(Sender: TObject);
procedure RemoveTabActionExecute(Sender: TObject); procedure RemoveTabActionExecute(Sender: TObject);
procedure BrowserTabCtrlChange(Sender: TObject); procedure BrowserTabCtrlChange(Sender: TObject);
procedure PrevTabActionExecute(Sender: TObject);
procedure NextTabActionExecute(Sender: TObject);
procedure ShowTabsActionExecute(Sender: TObject);
protected protected
// Variables to control when can we destroy the form safely // Variables to control when can we destroy the form safely
@ -405,6 +414,26 @@ begin
TBrowserTab(BrowserTabCtrl.ActiveTab).SendCaptureLostEvent; TBrowserTab(BrowserTabCtrl.ActiveTab).SendCaptureLostEvent;
end; end;
procedure TMainForm.NextTabActionExecute(Sender: TObject);
begin
if (BrowserTabCtrl.TabIndex < pred(BrowserTabCtrl.TabCount)) then
BrowserTabCtrl.TabIndex := BrowserTabCtrl.TabIndex + 1;
end;
procedure TMainForm.PrevTabActionExecute(Sender: TObject);
begin
if (BrowserTabCtrl.TabIndex > 0) then
BrowserTabCtrl.TabIndex := BrowserTabCtrl.TabIndex - 1;
end;
procedure TMainForm.ShowTabsActionExecute(Sender: TObject);
begin
if (BrowserTabCtrl.TabPosition = TTabPosition.PlatformDefault) then
BrowserTabCtrl.TabPosition := TTabPosition.None
else
BrowserTabCtrl.TabPosition := TTabPosition.PlatformDefault;
end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure TMainForm.HandleSYSCHAR(const aMessage : TMsg); procedure TMainForm.HandleSYSCHAR(const aMessage : TMsg);
begin begin

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 249, "InternalVersion" : 250,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "88.2.1.0" "Version" : "88.2.1.0"
} }