Skip to content

Commit cee9d77

Browse files
committed
Fixing types inheritance
1 parent 3df8b2f commit cee9d77

File tree

4 files changed

+80
-18
lines changed

4 files changed

+80
-18
lines changed

Packages/Delphi/Delphi 10.4+/PythonFmx.dpk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ contains
4848
WrapFmxShapes in '..\..\..\Source\fmx\WrapFmxShapes.pas',
4949
WrapFmxStdCtrls in '..\..\..\Source\fmx\WrapFmxStdCtrls.pas',
5050
WrapFmxTypes in '..\..\..\Source\fmx\WrapFmxTypes.pas',
51-
WrapDelphiFmx in '..\..\..\Source\fmx\WrapDelphiFmx.pas';
51+
WrapDelphiFmx in '..\..\..\Source\fmx\WrapDelphiFmx.pas',
52+
WrapFmxEdit in '..\..\..\Source\fmx\WrapFmxEdit.pas',
53+
WrapFmxListBox in '..\..\..\Source\fmx\WrapFmxListBox.pas';
5254

5355
end.

Source/fmx/WrapDelphiFmx.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ implementation
1212
WrapFmxTypes,
1313
WrapFmxStdCtrls,
1414
WrapFmxEdit,
15-
WrapFmxList,
15+
WrapFmxListBox,
1616
WrapFmxActnList,
1717
WrapFmxComCtrls,
1818
WrapFmxDialogs,

Source/fmx/WrapFmxEdit.pas

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
{$I Definition.Inc}
1+
{$I ..\Definition.Inc}
22

33
unit WrapFmxEdit;
44

55
interface
66

77
uses
8-
FMX.Edit, WrapFmxTypes, PythonEngine;
8+
FMX.Edit, PythonEngine, WrapFmxTypes, WrapFmxControls;
99

1010

1111
type
12-
TPyDelphiEdit = class(TPyDelphiFMXObject)
12+
TPyDelphiCustomEdit = class(TPyDelphiPresentedControl)
13+
private
14+
function GetDelphiObject: TCustomEdit;
15+
procedure SetDelphiObject(const Value: TCustomEdit);
16+
public
17+
class function DelphiObjectClass: TClass; override;
18+
// Properties
19+
property DelphiObject: TCustomEdit read GetDelphiObject
20+
write SetDelphiObject;
21+
end;
22+
23+
TPyDelphiEdit = class(TPyDelphiCustomEdit)
1324
private
1425
function GetDelphiObject: TEdit;
1526
procedure SetDelphiObject(const Value: TEdit);
@@ -50,9 +61,27 @@ procedure TEditRegistration.RegisterWrappers(
5061
APyDelphiWrapper: TPyDelphiWrapper);
5162
begin
5263
inherited;
64+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomEdit);
5365
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiEdit);
5466
end;
5567

68+
{ TPyDelphiCustomEdit }
69+
70+
class function TPyDelphiCustomEdit.DelphiObjectClass: TClass;
71+
begin
72+
Result := TCustomEdit;
73+
end;
74+
75+
function TPyDelphiCustomEdit.GetDelphiObject: TCustomEdit;
76+
begin
77+
Result := TCustomEdit(inherited DelphiObject);
78+
end;
79+
80+
procedure TPyDelphiCustomEdit.SetDelphiObject(const Value: TCustomEdit);
81+
begin
82+
inherited DelphiObject := Value;
83+
end;
84+
5685
{ TPyDelphiEdit }
5786

5887
class function TPyDelphiEdit.DelphiObjectClass: TClass;

Source/fmx/WrapFmxListBox.pas

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
{$I Definition.Inc}
1+
{$I ..\Definition.Inc}
22

33
unit WrapFmxListBox;
44

55
interface
66

77
uses
8-
FMX.ListBox, WrapFmxTypes, PythonEngine;
8+
FMX.ListBox, WrapFmxTypes, WrapFmxControls, WrapFmxLayouts, PythonEngine;
99

1010
type
11-
TPyListBoxItem = class(TPyDelphiFMXObject)
11+
TPyListBoxItem = class(TPyDelphiTextControl)
1212
private
1313
function GetDelphiObject: TListBoxItem;
1414
procedure SetDelphiObject(const Value: TListBoxItem);
@@ -17,7 +17,19 @@ TPyListBoxItem = class(TPyDelphiFMXObject)
1717
property DelphiObject: TListBoxItem read GetDelphiObject
1818
write SetDelphiObject;
1919
end;
20-
TPyDelphiListBox = class(TPyDelphiFMXObject)
20+
21+
TPyDelphiCustomListBox = class(TPyDelphiScrollBox)
22+
private
23+
function GetDelphiObject: TCustomListBox;
24+
procedure SetDelphiObject(const Value: TCustomListBox);
25+
public
26+
class function DelphiObjectClass: TClass; override;
27+
// Properties
28+
property DelphiObject: TCustomListBox read GetDelphiObject
29+
write SetDelphiObject;
30+
end;
31+
32+
TPyDelphiListBox = class(TPyDelphiCustomListBox)
2133
private
2234
function GetDelphiObject: TListBox;
2335
procedure SetDelphiObject(const Value: TListBox);
@@ -58,40 +70,59 @@ procedure TListBoxRegistration.RegisterWrappers(
5870
APyDelphiWrapper: TPyDelphiWrapper);
5971
begin
6072
inherited;
73+
APyDelphiWrapper.RegisterDelphiWrapper(TPyListBoxItem);
74+
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiCustomListBox);
6175
APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiListBox);
6276
end;
6377

64-
{ TPyDelphiListBox }
78+
{ TPyListBoxItem }
6579

66-
class function TPyDelphiListBox.DelphiObjectClass: TClass;
80+
class function TPyListBoxItem.DelphiObjectClass: TClass;
6781
begin
6882
Result := TListBox;
6983
end;
7084

71-
function TPyDelphiListBox.GetDelphiObject: TListBox;
85+
function TPyListBoxItem.GetDelphiObject: TListBoxItem;
7286
begin
73-
Result := TListBox(inherited DelphiObject);
87+
Result := TListBoxItem(inherited DelphiObject);
7488
end;
7589

90+
procedure TPyListBoxItem.SetDelphiObject(const Value: TListBoxItem);
91+
begin
92+
inherited DelphiObject := Value;
93+
end;
7694

77-
procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox);
95+
{ TPyDelphiCustomListBox }
96+
97+
class function TPyDelphiCustomListBox.DelphiObjectClass: TClass;
98+
begin
99+
Result := TCustomListBox;
100+
end;
101+
102+
function TPyDelphiCustomListBox.GetDelphiObject: TCustomListBox;
103+
begin
104+
Result := TCustomListBox(inherited DelphiObject);
105+
end;
106+
107+
procedure TPyDelphiCustomListBox.SetDelphiObject(const Value: TCustomListBox);
78108
begin
79109
inherited DelphiObject := Value;
80110
end;
81111

82-
{ TPyListBoxItem }
112+
{ TPyDelphiListBox }
83113

84-
class function TPyListBoxItem.DelphiObjectClass: TClass;
114+
class function TPyDelphiListBox.DelphiObjectClass: TClass;
85115
begin
86116
Result := TListBox;
87117
end;
88118

89-
function TPyListBoxItem.GetDelphiObject: TListBoxItem;
119+
function TPyDelphiListBox.GetDelphiObject: TListBox;
90120
begin
91121
Result := TListBox(inherited DelphiObject);
92122
end;
93123

94-
procedure TPyListBoxItem.SetDelphiObject(const Value: TListBoxItem);
124+
125+
procedure TPyDelphiListBox.SetDelphiObject(const Value: TListBox);
95126
begin
96127
inherited DelphiObject := Value;
97128
end;

0 commit comments

Comments
 (0)