This topic covers the implementation details of TDateRules.
Scope: cpDateRules.pas; class derived from TBtnEditProperty. Prepared from the curated implementation supplied for this review on 2 October 2026.
The XML uses literal French identifiers Mois and Jour, plus Period, OffsetY, Start, Weekday, WeekdayOffset and WeekNumber. The constructor distinguishes beginning/end rules: January 1 with Start=true, or December 31 with Start=false. Do not translate element names.
The reader preserves the existing DataValue as its starting point. Legal Period/weekday modes and scheduling semantics require the corresponding consumers; ordinals or integer values alone do not establish the rules.
Notation and shared helper rules: Reading this reference.
No literal rec_type value is emitted directly by the selected routines. A property envelope, an inherited writer or a delegated record can supply its identifying attributes.
Inherited implementation: TBtnEditProperty. Follow it when the ordered behavior invokes inherited methods; inherited fields are not repeated as locally owned fields.
Exact XML fields and attributes
The paths below start at this record or property node. A slash identifies a child element; @ identifies an attribute. Curly braces mark a variable index or expression, not literal XML text. Initial values describe initialization; they do not establish what an omitted individual element does. The Implementation toggle below contains the supplied routines for exact branch order and conversions.
Period
XML representation: The text of the Period element.
Reading: Reads the element into aPropValue.DateRule.Period.
Writing: Stores the text representation of DataValue.DateRule.Period whenever the writer reaches this field.
OffsetY
XML representation: The text of the OffsetY element.
Reading: Reads the element into aPropValue.DateRule.OffsetY.
Writing: Stores the text representation of DataValue.DateRule.OffsetY whenever the writer reaches this field.
Mois
XML representation: The text of the Mois element.
Reading: Reads the element into aPropValue.DateRule.Mois.
Writing: Stores the text representation of DataValue.DateRule.Mois whenever the writer reaches this field.
Jour
XML representation: The text of the Jour element.
Reading: Reads the element into aPropValue.DateRule.Jour.
Writing: Stores the text representation of DataValue.DateRule.Jour whenever the writer reaches this field.
Start
XML representation: The text of the Start element.
Reading: Reads the element into aPropValue.DateRule.Start.
Writing: Stores true or false according to DataValue.DateRule.Start whenever the writer reaches this field.
Weekday
XML representation: The text of the Weekday element.
Reading: Reads the element into aPropValue.DateRule.Weekday.
Writing: Stores the text representation of DataValue.DateRule.Weekday whenever the writer reaches this field.
WeekdayOffset
XML representation: The text of the WeekdayOffset element.
Reading: Reads the element into aPropValue.DateRule.WeekdayOffset.
Writing: Stores the text representation of DataValue.DateRule.WeekdayOffset whenever the writer reaches this field.
WeekNumber
XML representation: The text of the WeekNumber element.
Reading: Reads the element into aPropValue.DateRule.WeekNumber.
Writing: Stores the text representation of DataValue.DateRule.WeekNumber whenever the writer reaches this field.
Initialization and reset values
TDateRules.CreateInit
Setting or temporary variable |
Initial value |
When it is assigned |
PropName |
“DateRules” |
Always |
DisabledDisplayText |
“See Insertion Rule below” |
Always |
Required |
1 |
Always |
PropValue.PropertyType |
ptDateRules |
Always |
PropValue.DateRule.Period |
1 |
Always |
PropValue.DateRule.OffsetY |
0 |
Always |
PropValue.DateRule.Start |
IsBeginning |
Always |
PropValue.DateRule.Mois |
1 |
IsBeginning is true |
PropValue.DateRule.Jour |
1 |
IsBeginning is true |
PropValue.DateRule.Mois |
12 |
IsBeginning is false |
PropValue.DateRule.Jour |
31 |
IsBeginning is false |
PropValue.DateRule.Weekday |
0 |
Always |
PropValue.DateRule.WeekdayOffset |
0 |
Always |
PropValue.DateRule.WeekNumber |
0 |
Always |
DataValue |
PropValue |
Always |
This routine also calls inherited Create; self.FillDisplayValue. See Implementation for their order and any conditional calls.
Storage declarations relevant to interpretation
These are in-memory member and property types, not a list of mandatory XML children. They retain array bounds, fixed buffers and selector types. The field reference above defines what is actually serialized.
The Implementation toggle contains only TDateRules methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.