The Relationship Between Messages and Events

Now that you know all the ins and outs of messages, recall that this chapter began by stating that VCL encapsulates many Windows messages in its event system. Delphi's event system is designed to be an easy interface into Windows messages. Many VCL events have a direct correlation with WM_XXX Windows messages. Table 3.3 shows some common VCL events and the Windows message responsible for each event.

Table 3.3. VCL Events and Corresponding Windows Messages
VCL Event Windows Message
OnActivate wm_Activate
OnClick wm_XButtonDown
OnCreate wm_Create
OnDblClick wm_XButtonDblClick
OnKeyDown wm_KeyDown
OnKeyPress wm_Char
OnKeyUp wm_KeyUp
OnPaint WM_PAINT
OnResize wm_Size
OnTimer wm_Timer

Table 3.3 is a good ...

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.