Identifying Standard Events

From RAD Studio
Jump to: navigation, search

Go Up to Implementing the Standard Events


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 Using the Windows API Messaging Solution for information on writing message handlers.

See Also