In Windows application development the OnMessage or DelphiVCL.Application.OnMessage occurs when the application receives a message from either the Windows operating system or another application.
Table of Contents
How to use the DelphiVCL.Application.OnMessage event properly?
We use the OnMessage to trap any or all Windows messages posted to all windows in the application. The OnMessage event occurs when an application receives a Windows message. An OnMessage event handler allows an application to respond to messages other than those declared in the events for TApplication. If the application does not have a specific handler for an incoming message, the message is dispatched to the window for which it was intended, and Windows handles the message.
Note: OnMessage only receives messages that are posted to the message queue, not those sent directly with the Windows API SendMessage function.
Caution: Thousands of messages per second flow through this event. Be careful when coding the handler, because it can affect the performance of the entire application.
Note: You can also respond to this event using the TApplicationEvents
component, which allows you to assign an event handler using the IDE.
How do I examine the properties and methods of the DelphiVCL.Application.OnMessage event?
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.OnMessage using the dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL.Application.OnMessage) |
See the responses in our Windows command prompt:
You can also read short information about the DelphiVCL.Application.OnMessage using the print() command:
1 2 |
print(DelphiVCL.Application.OnMessage) print(DelphiVCL.Application.OnMessage.__doc__) |
See the responses in our Windows command prompt:
How can I get started with Python GUI building with DelphiVCL?
Here are the articles with ready to run Python scripts to get you started with DelphiVCL Python GUI Builder:
Browse all the DelphiVCL library documentation here:
https://pythongui.org/category/delphivcl/
This documentation is updated regularly.
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.