Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Demos/FMX/FormDemo/FormDemo.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
program FormDemo;

uses
System.StartUpCopy,
FMX.Forms,
MainForm in 'MainForm.pas' {Form1},
SecondForm in 'SecondForm.pas' {DelphiSecondForm};

{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
976 changes: 976 additions & 0 deletions Demos/FMX/FormDemo/FormDemo.dproj

Large diffs are not rendered by default.

153 changes: 153 additions & 0 deletions Demos/FMX/FormDemo/MainForm.fmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'MainForm'
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object OpenDialog1: TOpenDialog
DefaultExt = '*.py'
Filter = 'Python files|*.py|Text files|*.txt|All files|*.*'
Left = 200
end
object SaveDialog1: TSaveDialog
DefaultExt = '*.py'
Filter = 'Python files|*.py|Text files|*.txt|All files|*.*'
Left = 232
end
object Memo1: TMemo
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
DataDetectorTypes = []
Align = Top
Size.Width = 640.000000000000000000
Size.Height = 200.000000000000000000
Size.PlatformDefault = False
TabOrder = 8
Viewport.Width = 636.000000000000000000
Viewport.Height = 196.000000000000000000
end
object Splitter1: TSplitter
Align = Top
Cursor = crVSplit
MinSize = 20.000000000000000000
Position.Y = 200.000000000000000000
Size.Width = 640.000000000000000000
Size.Height = 3.000000000000000000
Size.PlatformDefault = False
end
object Memo2: TMemo
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
DataDetectorTypes = []
Lines.Strings = (
'from spam import Form'
''
'class SubForm(Form): '
' def __init__(self, Owner):'
' self.Caption = '#39'Subclassed form defined in Python'#39
''
'class DelphiSecondForm(Form):'
' pass'
''
'def createbaseform():'
' print('#39'Creates a Delphi FMX.TForm'#39')'
' form = Form(None)'
' try:'
' form.Caption = "Delphi FMX base form"'
' form.ShowModal()'
' finally:'
' form.Free();'
''
'def createpysubform():'
' print('#39'Creates a Delphi FMX.TForm subtype defined in Python'#39')'
' form = SubForm(None)'
' try:'
' form.ShowModal()'
' finally:'
' form.Free()'
''
'def createdelphisubform():'

' print('#39'Creates an instance of TDelphiSecondForm registerd form' +
#39')'
' form = DelphiSecondForm(None)'
' try:'
' print('#39'Label: '#39', form.Label1.Text)'
' form.ShowModal()'
' finally:'
' form.Free()'
''
'def main():'
' createbaseform()'
' createpysubform()'
' createdelphisubform()'
''
'if __name__ == '#39'__main__'#39':'
' try:'
' main()'
' except SystemExit:'
' pass')
Align = Client
Size.Width = 640.000000000000000000
Size.Height = 232.000000000000000000
Size.PlatformDefault = False
TabOrder = 10
Viewport.Width = 620.000000000000000000
Viewport.Height = 228.000000000000000000
end
object Panel1: TPanel
Align = Bottom
Position.Y = 435.000000000000000000
Size.Width = 640.000000000000000000
Size.Height = 45.000000000000000000
Size.PlatformDefault = False
TabOrder = 11
object Button1: TButton
Position.X = 8.000000000000000000
Position.Y = 10.000000000000000000
Size.Width = 97.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
TabOrder = 2
Text = 'Execute script'
OnClick = Button1Click
end
object Button2: TButton
Position.X = 192.000000000000000000
Position.Y = 10.000000000000000000
TabOrder = 1
Text = 'Load script...'
OnClick = Button2Click
end
object Button3: TButton
Position.X = 280.000000000000000000
Position.Y = 10.000000000000000000
TabOrder = 0
Text = 'Save script...'
OnClick = Button3Click
end
end
object PythonEngine1: TPythonEngine
IO = PythonGUIInputOutput1
Left = 8
end
object PythonModule1: TPythonModule
Engine = PythonEngine1
ModuleName = 'spam'
Errors = <>
Left = 40
end
object PythonGUIInputOutput1: TPythonGUIInputOutput
UnicodeIO = True
RawOutput = False
Output = Memo1
Left = 104
end
object PyDelphiWrapper1: TPyDelphiWrapper
Engine = PythonEngine1
Module = PythonModule1
Left = 72
end
end
63 changes: 63 additions & 0 deletions Demos/FMX/FormDemo/MainForm.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
unit MainForm;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox, FMX.Memo,
PythonEngine, WrapDelphi, FMX.PythonGUIInputOutput, WrapDelphiFmx;

type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Memo1: TMemo;
Splitter1: TSplitter;
Memo2: TMemo;
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
PythonEngine1: TPythonEngine;
PythonModule1: TPythonModule;
PythonGUIInputOutput1: TPythonGUIInputOutput;
PyDelphiWrapper1: TPyDelphiWrapper;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin
PythonEngine1.ExecStrings(Memo2.Lines);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
with OpenDialog1 do begin
if Execute then
Memo2.Lines.LoadFromFile( FileName );
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
with SaveDialog1 do begin
if Execute then
Memo2.Lines.SaveToFile(FileName);
end;
end;

end.
31 changes: 31 additions & 0 deletions Demos/FMX/FormDemo/SecondForm.fmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
object DelphiSecondForm: TDelphiSecondForm
Left = 0
Top = 0
Caption = 'Delphi second form'
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object Label1: TLabel
Align = Top
AutoSize = True
StyledSettings = [Family, FontColor]
Margins.Left = 10.000000000000000000
Margins.Top = 10.000000000000000000
Margins.Right = 10.000000000000000000
Margins.Bottom = 10.000000000000000000
Position.X = 10.000000000000000000
Position.Y = 10.000000000000000000
Size.Width = 620.000000000000000000
Size.Height = 30.000000000000000000
Size.PlatformDefault = False
StyleLookup = 'labelstyle'
TextSettings.Font.Size = 22.000000000000000000
TextSettings.Font.StyleExt = {00070000000000000004000000}
TextSettings.HorzAlign = Center
Text = 'This is a Delphi registerd form'
TabOrder = 1
end
end
29 changes: 29 additions & 0 deletions Demos/FMX/FormDemo/SecondForm.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
unit SecondForm;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls;

type
TDelphiSecondForm = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;

var
DelphiSecondForm: TDelphiSecondForm;

implementation

{$R *.fmx}

initialization
RegisterClass(TDelphiSecondForm);

end.
23 changes: 23 additions & 0 deletions Source/fmx/WrapDelphiFmx.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
unit WrapDelphiFmx;

interface

implementation

uses
WrapDelphiTypes,
WrapDelphiClasses,
WrapDelphiWindows,
WrapFireDac,
WrapFmxTypes,
WrapFmxStdCtrls,
WrapFmxActnList,
WrapFmxComCtrls,
WrapFmxDialogs,
WrapFmxForms,
WrapFmxShapes,
WrapFmxLayouts,
WrapFmxScrollBox,
WrapFmxGrids;

end.
Loading