How Actions Find Their Targets

From RAD Studio

Go Up to Handling VCL Actions Using an Action List


What Happens When an Action Fires describes the execution cycle that occurs when a user invokes an action. If no event handler is assigned to respond to the action, either at the action list, application, or action level, then the application tries to identify a target object to which the action can apply itself.

The application looks for the target using the following sequence:

  1. Active control: The application looks first for an active control as a potential target.
  2. Active form: If the application does not find an active control or if the active control can't act as a target, it looks at the screen's ActiveForm.
  3. Controls on the form: If the active form is not an appropriate target, the application looks at the other controls on the active form for a target.

If no target is located, nothing happens when the event is fired.

Some controls can expand the search to defer the target to an associated component; for example, data-aware controls defer to the associated dataset component. Also, some predefined actions do not use a target; for example, the File Open dialog.

See Also