File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -616,25 +616,26 @@ TPyDelphiObjectClass = class of TPyDelphiObject;
616
616
Generic wrapper for pascal classes
617
617
618
618
Can be used from unit wrappers as follows:
619
- APyDelphiWrapper .RegisterDelphiWrapper(TPyClassWrapper<TMyClass>);
619
+ PyDelphiWrapper1 .RegisterDelphiWrapper(TPyClassWrapper<TMyClass>);
620
620
or at runtime (e.g. inside the FormCreate handler:
621
621
PyDelphiWrapper1.RegisterDelphiWrapper(TPyClassWrapper<TMyClass>).Initialize;
622
622
623
623
if you want your class to capable of being instantiated from python then do:
624
624
625
- TTestWrapper = class(TPyClassWrapper<TTest >)
625
+ TMyClassWrapper = class(TPyClassWrapper<TMyClass >)
626
626
constructor CreateWith(APythonType: TPythonType; args, kwds: PPyObject); overload; override;
627
627
end;
628
628
629
- constuctor TTestWrapper .CreateWith(APythonType: TPythonType; args, kwds: PPyObject);
629
+ constuctor TMyClassWrapper .CreateWith(APythonType: TPythonType; args, kwds: PPyObject);
630
630
begin
631
631
Create(APythonType);
632
- DelphiObject := TTest .Create;
632
+ DelphiObject := TMyClass .Create;
633
633
end;
634
634
635
- PyDelphiWrapper1.RegisterDelphiWrapper(TTestWrapper ).Initialize;
635
+ PyDelphiWrapper1.RegisterDelphiWrapper(TMyClassWrapper ).Initialize;
636
636
}
637
637
TPyClassWrapper<T: class > = class (TPyDelphiObject)
638
+ private
638
639
function GetDelphiObject : T;
639
640
procedure SetDelphiObject (const Value : T);
640
641
public
You can’t perform that action at this time.
0 commit comments