File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,42 @@ implementation
5050uses
5151 WrapDelphiTypes;
5252
53+ { Global Functions }
54+ function ShowMessage_Wrapper (pself, args: PPyObject): PPyObject; cdecl;
55+ var
56+ LMsg: string;
57+ begin
58+ with GetPythonEngine do
59+ begin
60+ if PyArg_ParseTuple(args, ' s:ShowMessage' , @LMsg) <> 0 then
61+ begin
62+ ShowMessage(LMsg);
63+ Result := GetPythonEngine.ReturnNone;
64+ end else
65+ Result := nil ;
66+ end ;
67+ end ;
68+
5369{ Register the wrappers, the globals and the constants }
5470type
5571 TDialogRegistration = class (TRegisteredUnit)
5672 public
5773 function Name : string; override;
5874 procedure RegisterWrappers (APyDelphiWrapper: TPyDelphiWrapper); override;
5975 procedure DefineVars (APyDelphiWrapper: TPyDelphiWrapper); override;
76+ procedure DefineFunctions (APyDelphiWrapper : TPyDelphiWrapper); override;
6077 end ;
6178
6279 { TDialogRegistration }
80+ procedure TDialogRegistration.DefineFunctions (
81+ APyDelphiWrapper: TPyDelphiWrapper);
82+ begin
83+ inherited ;
84+ APyDelphiWrapper.RegisterFunction(PAnsiChar(' ShowMessage' ), ShowMessage_Wrapper,
85+ PAnsiChar(' ShowMessage_Wrapper()' #10 +
86+ ' Show a custom message as a dialog box.' ));
87+ end ;
88+
6389procedure TDialogRegistration.DefineVars (APyDelphiWrapper: TPyDelphiWrapper);
6490begin
6591 inherited ;
You can’t perform that action at this time.
0 commit comments