Skip to content

Commit 6851c2b

Browse files
committed
Adjusting FMX.Controls.TControl wrapper
1 parent d646f76 commit 6851c2b

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

Source/fmx/WrapFmxControls.pas

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface
77
uses
88
Classes, SysUtils, TypInfo, Types,
99
Fmx.Controls,
10-
PythonEngine, WrapDelphi, WrapDelphiClasses;
10+
PythonEngine, WrapDelphi, WrapDelphiClasses, WrapFmxTypes;
1111

1212
type
1313
{
@@ -16,7 +16,7 @@ interface
1616
SetBounds and Repaint
1717
Exposes properties Parent and Visible
1818
}
19-
TPyDelphiControl = class (TPyDelphiComponent)
19+
TPyDelphiControl = class (TPyDelphiFmxObject)
2020
private
2121
function GetDelphiObject: TControl;
2222
procedure SetDelphiObject(const Value: TControl);
@@ -32,13 +32,12 @@ TPyDelphiControl = class (TPyDelphiComponent)
3232
function SetFocus_Wrapper(args: PPyObject): PPyObject; cdecl;
3333
function ResetFocus_Wrapper(args: PPyObject): PPyObject; cdecl;
3434
// Property Getters
35-
function Get_Parent( AContext : Pointer) : PPyObject; cdecl;
3635
function Get_Visible(AContext: Pointer): PPyObject; cdecl;
3736
function Get_ControlsCount( AContext : Pointer) : PPyObject; cdecl;
3837
function Get_Controls(AContext: Pointer): PPyObject; cdecl;
3938
function Get_IsFocused( AContext : Pointer) : PPyObject; cdecl;
39+
function Get_ParentControl( AContext : Pointer) : PPyObject; cdecl;
4040
// Property Setters
41-
function Set_Parent( AValue : PPyObject; AContext : Pointer) : integer; cdecl;
4241
function Set_Visible(AValue: PPyObject; AContext: Pointer): integer; cdecl;
4342
public
4443
class function DelphiObjectClass : TClass; override;
@@ -69,7 +68,7 @@ TControlsAccess = class(TContainerAccess)
6968
implementation
7069

7170
uses
72-
WrapFmxTypes, FMX.Types;
71+
FMX.Types;
7372

7473
type
7574
{ Register the wrappers, the globals and the constants }
@@ -156,10 +155,10 @@ function TPyDelphiControl.Get_Controls(AContext: Pointer): PPyObject;
156155
Setup(Self.PyDelphiWrapper, TControlsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
157156
end;
158157

159-
function TPyDelphiControl.Get_Parent(AContext: Pointer): PPyObject;
158+
function TPyDelphiControl.Get_ParentControl(AContext: Pointer): PPyObject;
160159
begin
161160
Adjust(@Self);
162-
Result := Wrap(DelphiObject.Parent);
161+
Result := Wrap(DelphiObject.ParentControl);
163162
end;
164163

165164
function TPyDelphiControl.Get_Visible(AContext: Pointer): PPyObject;
@@ -171,8 +170,6 @@ function TPyDelphiControl.Get_Visible(AContext: Pointer): PPyObject;
171170
class procedure TPyDelphiControl.RegisterGetSets(PythonType: TPythonType);
172171
begin
173172
inherited;
174-
PythonType.AddGetSet('Parent', @TPyDelphiControl.Get_Parent, @TPyDelphiControl.Set_Parent,
175-
'Returns/Sets the Control Visibility', nil);
176173
PythonType.AddGetSet('Visible', @TPyDelphiControl.Get_Visible, @TPyDelphiControl.Set_Visible,
177174
'Returns/Sets the Control Visibility', nil);
178175
PythonType.AddGetSet('ControlsCount', @TPyDelphiControl.Get_ControlsCount, nil,
@@ -307,21 +304,6 @@ function TPyDelphiControl.SetFocus_Wrapper(args: PPyObject): PPyObject;
307304
end;
308305
end;
309306

310-
function TPyDelphiControl.Set_Parent(AValue: PPyObject;
311-
AContext: Pointer): integer;
312-
var
313-
_object : TObject;
314-
begin
315-
Adjust(@Self);
316-
if CheckObjAttribute(AValue, 'Parent', TFmxObject, _object) then
317-
begin
318-
Self.DelphiObject.Parent := TFmxObject(_object);
319-
Result := 0;
320-
end
321-
else
322-
Result := -1;
323-
end;
324-
325307
function TPyDelphiControl.Set_Visible(AValue: PPyObject;
326308
AContext: Pointer): integer;
327309
var

0 commit comments

Comments
 (0)