Quick start manual
Classes and objects
7-17
Properties
for the given ID, inherited calls the DefaultHandler method originally defined in
TObject.
The implementation of DefaultHandler in TObject simply returns without performing
any actions. By overriding DefaultHandler, a class can implement its own default
handling of messages. On Windows, the DefaultHandler method for WinCLX controls
calls the Windows DefWindowProc function.
Message dispatching
Message handlers are seldom called directly. Instead, messages are dispatched to an
object using the Dispatch method inherited from TObject:
procedure Dispatch(var Message);
The Message parameter passed to Dispatch must be a record whose first entry is a field
of type Word containing a message ID.
Dispatch searches backward through the class hierarchy (starting from the class of the
object where it is called) and invokes the first message method for the ID passed to it.
If no message method is found for the given ID, Dispatch calls DefaultHandler.
Properties
A property, like a field, defines an attribute of an object. But while a field is merely a
storage location whose contents can be examined and changed, a property associates
specific actions with reading or modifying its data. Properties provide control over
access to an object’s attributes, and they allow attributes to be computed.
The declaration of a property specifies a name and a type, and includes at least one
access specifier. The syntax of a property declaration is
property propertyName[indexes]: type index integerConstant specifiers;
where
• propertyName is any valid identifier.
• [indexes] is optional and is a sequence of parameter declarations separated by
semicolons. Each parameter declaration has the form identifier
1
, ..., identifier
n
:
type. For more information, see “Array properties” on page 7-20.
• type must be a predefined or previously declared type identifier. That is, property
declarations like property Num: 0..9 ... are invalid.
•the index integerConstant clause is optional. For more information, see “Index
specifiers” on page 7-21.
• specifiers is a sequence of read, write, stored, default (or nodefault), and
implements specifiers. Every property declaration must have at least one read or
write specifier. (For information about implements, see “Implementing interfaces
by delegation” on page 10-7.)