Delphi This Is The DelphiVCL.Application.MethodAddress Method

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,203
Credits
4,034
This Is The DelphiVCL.Application.MethodAddress Method
By Muhammad Azizul Hakim September 30, 2021

What is the Purpose of DelphiVCL.Application.MethodAddress?​

MethodAddress or DelphiVCL.Application.MethodAddress method returns the address of a class method by name.

Note: You can use MethodAddress for published methods only.

How to use DelphiVCL.Application.MethodAddress in Delphi?​

To give some sense of how to use this method in Python, let’s learn about how to use it in Delphi.

Here is an easy way to invoke the method is to define a procedure or function data type, such as:
Код:
type TProc = procedure of object;
Assign the object name and the MethodAddress method to a TMethod variable, such as:
Код:
MethodVar.Data := Pointer(ObjectInstanceName);
MethodVar.Code := ObjectInstanceName.MethodAddress('MethodNameString');
Pass this in a call to a variable of the procedure or function type:
Код:
Proc := TProc(MethodVar);
Proc;

How to browse the properties, methods, and built-in properties of the DelphiVCL.Application.MethodAddress?​

Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.MethodAddress using dir() command:
Python:
import DelphiVCL
 
dir(DelphiVCL.Application.MethodAddress)
See the responses in our Windows command prompt:
1633076962658.png
You can also read short information about the DelphiVCL.Application.MethodAddress using the print() command:
Python:
print(DelphiVCL.Application.MethodAddress)
print(DelphiVCL.Application.MethodAddress.__doc__)
See the responses in our Windows command prompt:
1633076992725.png