Name
Stored Directive
Syntax
propertyName:TypeDirectives... storedBoolean;
Description
The stored
directive takes a Boolean value: a
method that returns a Boolean result, a Boolean-type field reference,
or a constant expression of Boolean type. The property’s RTTI
records the field offset, method reference, or constant value, and
Delphi’s IDE uses this information to decide whether to omit
the property from the .dfm file.
The IDE calls the method, checks the field’s value, or uses the
constant Boolean value, and if the value is False,
the property is not saved to the .dfm file. If
the stored value is True, the default behavior
occurs, namely, that the property is stored if its value is different
from the default value.
Tips and Tricks
The
storeddirective is often misunderstood. SettingstoredtoTruedoes not force Delphi to store the property value in the .dfm file.Trueis the default value of thestoreddirective. Instead, all you can do is omit the property from the .dfm file by settingstoredtoFalse.You can use
storedwith properties at any access level, but it has meaning only for published properties.If you use a method name, the method can be static or virtual, but not dynamic or a message handler.
A field reference can be a field name, a record member, or an array element with a constant index. The field reference must have a Boolean type.
Example
Delphi’s TFont class lets you specify a
font’s size in points or pixels. The Height property is the font’s height in pixels, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access