RAD Studio |  |

Identifying Standard Events
Standard events for all controls | Standard events for standard controls
Collapse All

There are two categories of standard events: those defined for all controls and those defined only for the standard windowed controls.

Standard events for all controls

The most basic events are defined in the class TControl. All controls, whether windowed, graphical, or custom, inherit these events. The following events are available in all controls:

- OnClick
- OnDblClick
- OnDragDrop
- OnDragOver
- OnEndDrag
- OnMouseMove
- OnMouseDown
- OnMouseUp

The standard events have corresponding protected virtual methods declared in TControl, with names that correspond to the event names. For example, OnClick events call a method named Click, and OnEndDrag events call a method named DoEndDrag.
Standard events for standard controls

In addition to the events common to all controls, standard windowed controls (those that descend from TWinControl) have the following events:

- OnEnter
- OnKeyPress
- OnKeyDown
- OnKeyUp
- OnExit

Like the standard events in TControl, the windowed control events have corresponding methods. The standard key events listed above respond to all normal keystrokes.
Note: To respond to special keystrokes (such as the Alt
key), however, you must respond to the WM_GETDLGCODE or CM_WANTSPECIALKEYS message from Windows. See Handling messages and system notifications for information on writing message handlers.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!