unit TabbedTemplate;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.TabControl,
FMX.StdCtrls, FMX.Gestures, FMX.Controls.Presentation, FMX.Media;
type
TTabbedForm = class(TForm)
HeaderToolBar: TToolBar;
ToolBarLabel: TLabel;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
TabItem3: TTabItem;
TabItem4: TTabItem;
GestureManager1: TGestureManager;
Button1: TButton;
MediaPlayer1: TMediaPlayer;
procedure FormCreate(Sender: TObject);
procedure FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo;
var Handled: Boolean);
procedure Button1Click(Sender: TObject);
procedure PlaySound;
private
{ Private declarations }
public
{ Public declarations }
end;
const
conSoundAlter = 'C:\Users\Sven\Documents\Embarcadero\Studio\Projekte\Soundbord\Sounds\xx.mp3';
var
TabbedForm: TTabbedForm;
implementation
{$R *.fmx}
procedure TTabbedForm.FormCreate(Sender: TObject);
begin
{ This defines the default active tab at runtime }
TabControl1.ActiveTab := TabItem1;
end;
procedure TTabbedForm.FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
{$IFDEF ANDROID}
case EventInfo.GestureID of
sgiLeft:
begin
if TabControl1.ActiveTab <> TabControl1.Tabs[TabControl1.TabCount - 1]
then
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex + 1];
Handled := True;
end;
sgiRight:
begin
if TabControl1.ActiveTab <> TabControl1.Tabs[0] then
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex - 1];
Handled := True;
end;
end;
{$ENDIF}
end;
procedure TTabbedForm.Button1Click(Sender: TObject);
begin
TTabbedForm.playSound(conSoundAlter);
end;
procedure TTabbedForm.playSound(DataLink);
begin
MediaPlayer1.FileName := DataLink;
MediaPlayer1.Play;
end;
end.