RAD Studio
ContentsIndex
PreviousUpNext
Identifying Standard Events

There are two categories of standard events: those defined for all controls and those defined only for the standard windowed 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.

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) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!