Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə178/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   174   175   176   177   178   179   180   181   ...   294
DelphiLanguageGuide

Storage Specifiers
The optional stored, default, and nodefault directives are called storage specifiers. They have no effect on program
behavior, but control whether or not to save the values of published properties in form files.
The stored directive must be followed by True, False, the name of a Boolean field, or the name of a parameterless
method that returns a Boolean value. For example,
property Name: TComponentName read FName write SetName stored False;
If a property has no stored directive, it is treated as if stored True were specified.
The default directive must be followed by a constant of the same type as the property. For example,
property Tag: Longint read FTag write FTag default 0;
To override an inherited default value without specifying a new one, use the nodefault directive. The default and
nodefault directives are supported only for ordinal types and for set types, provided the upper and lower bounds of
the set's base type have ordinal values between 0 and 31; if such a property is declared without default or nodefault,
it is treated as if nodefault were specified. For reals, pointers, and strings, there is an implicit default value of 0, nil,
and 
''
 (the empty string), respectively.
Note:
You can't use the ordinal value 2147483648 has a default value. This value is used internally to represent
nodefault.
When saving a component's state, the storage specifiers of the component's published properties are checked. If a
property's current value is different from its default value (or if there is no default value) and the stored specifier is
True, then the property's value is saved. Otherwise, the property's value is not saved.
Note:
Property values are not automatically initialized to the default value. That is, the default directive controls only
when property values are saved to the form file, but not the initial value of the property on a newly created
instance.
Storage specifiers are not supported for array properties. The default directive has a different meaning when used
in an array property declaration. See Array Properties, above.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   174   175   176   177   178   179   180   181   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin