In this post, you’ll learn more about NewInstance or DelphiVCL.Application.NewInstance method allocates memory for an instance of an object type and returns a pointer to that new instance. All constructors call NewInstance automatically. NewInstance calls InstanceSize to determine how much memory contains a particular instance to allocate from the heap. Do not call NewInstance directly.
Learning how to use NewInstance Method will allow you to easily build applications and GUIs with Python programming software.
Table of Contents
How to use the DelphiVCL.Application.NewInstance Method properly?
Override NewInstance only for special memory allocation requirements. For example, when allocating a large number of identical objects that all need to be in memory at the same time, you can allocate a single block of memory for the entire group, then override NewInstance to use part of that larger block for each instance.
If you override NewInstance to allocate memory, you may need to override FreeInstance to deallocate the memory.
Note: By default, NewInstance calls InitInstance.
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.NewInstance using dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL.Application.NewInstance) |
See the responses in our Windows command prompt:
You can also read short information about the DelphiVCL.Application.NewInstance using the print() command:
1 2 |
print(DelphiVCL.Application.NewInstance) print(DelphiVCL.Application.NewInstance.__doc__) |
See the responses in our Windows command prompt:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.