System.TObject.Dispatch

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Dispatch(var Message); virtual;

C++

virtual void __fastcall Dispatch(void *Message);

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.pas
systobj.h
System TObject

Description

Calls message-handling methods for the object, based on the contents of the Message parameter.

Call Dispatch to automatically pass messages to the appropriate message handler.

Dispatch determines whether a message is in the list of message handlers declared for the object. If the object does not handle the message, Dispatch then examines the message-handler list of the ancestor class, and continues checking ancestors until it either finds a specific handler or runs out of ancestors, in which case it calls DefaultHandler.

The only assumption Dispatch makes about the data in Message is that the first two bytes contain a message ID—that is, an integer that determines which message handler Dispatch calls. Although any kind of data can be passed to Dispatch, most TObject descendants expect a message record such as TMessage or a specific data structure type.

See Also

Code Examples