This topic covers the implementation details of TTextShadeRec.
Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.
State uses qcbUnchecked=0, qcbChecked=1, qcbGrayed=2. Payload is read/written for checked state and then restricted by ComboType and Options. Options is a comma-terminated list of enum ordinals.
Numeric selected values use Trunc(value×10000). None/BoxKeep/BoxDelete emit no detailed shade payload; BoxModify and BoxCreate return before later text-only fields.
Legacy-read anomaly: the code reads key buffRight into buffInt, leaving buffRight zero before UpdateFromLeftRightValues. Do not document this as the intended legacy mapping.
Notation and shared helper rules: Reading this reference.
Literal rec_type values emitted within these routines: TComboTextShadeRec, TTextShadeRec. Nested values may belong to child wrappers rather than this owner itself; the attribute entries below give their exact locations.
Structures used directly by this XML implementation:
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.
Left
XML representation: The text of the Left element.
Initial value: 0 (TTextShadeRec.Initialize).
Reading: Reads the element into buffLeft when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.FWasReadIn is false. Before this read, buffLeft is set to 0.
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Left when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4). The temporary numeric value starts at 0 before reading.
Writing: Stores Left multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); tshLeft is selected in Options.
buffRight
XML representation: The text of the buffRight element.
Reading: Reads the element into buffInt when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.FWasReadIn is false.
Export: No corresponding write is implemented locally. This can be a compatibility input or a field handled elsewhere.
State
XML representation: The text of the State element.
Initial value: qcbGrayed (2) (TTextShadeRec.Initialize).
Reading: Reads the element into State when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete].
Writing: Stores the numeric value of State (see the value table below) when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete].
Options
XML representation: The text of the Options element.
Reading: Reads the stored value for Options; its subsequent processing is shown in Implementation when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1).
Writing: Stores strOptions when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1).
ColorName
XML representation: The text of the ColorName element.
Initial value: an empty string (TTextShadeRec.Initialize).
Reading: Reads the element into ColorName when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1).
Writing: Stores ColorName when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); tshColor is selected in Options.
Shade
XML representation: The text of the Shade element.
Initial value: 100 (TTextShadeRec.Initialize).
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Shade when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1). The temporary numeric value starts at 100 * 10000 before reading.
Writing: Stores Shade multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); tshShade is selected in Options.
Opacity
XML representation: The text of the Opacity element.
Initial value: 100 (TTextShadeRec.Initialize).
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Opacity when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1). The temporary numeric value starts at 100 * 10000 before reading.
Writing: Stores Opacity multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); tshOpacity is selected in Options.
Top
XML representation: The text of the Top element.
Initial value: 0 (TTextShadeRec.Initialize).
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Top when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4). The temporary numeric value starts at 0 before reading.
Writing: Stores Top multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); tshTop is selected in Options.
Bottom
XML representation: The text of the Bottom element.
Initial value: 0 (TTextShadeRec.Initialize).
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Bottom when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4). The temporary numeric value starts at 0 before reading.
Writing: Stores Bottom multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); tshBottom is selected in Options.
Right
XML representation: The text of the Right element.
Initial value: 0 (TTextShadeRec.Initialize).
Reading: Reads the stored number, divides it by 10000.0, and assigns the result to Right when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4). The temporary numeric value starts at 0 before reading.
Writing: Stores Right multiplied by 10000.0, then truncated to an integer when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); tshRight is selected in Options.
ClipToBox
XML representation: The text of the ClipToBox element.
Initial value: false (TTextShadeRec.Initialize).
Reading: Reads the element into ClipToBox when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4); ComboRec.ComboType is not cfsBoxCreate (2).
Writing: Stores true or false according to ClipToBox when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); ComboType is not cfsBoxCreate (2); tshClipToBox is selected in Options.
Length
XML representation: The text of the Length element.
Reading: Reads the element into Length when the record node exists; ComboRec.ComboType is not cfsNone (0); the State child element exists; ComboRec.ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboRec.ComboType is not cfsBoxModify (4); ComboRec.ComboType is not cfsBoxCreate (2).
Writing: Stores the numeric value of Length (see the value table below) when ComboType is not one of [cfsNone, cfsBoxKeep, cfsBoxDelete]; State is qcbChecked (1); ComboType is not cfsBoxModify (4); ComboType is not cfsBoxCreate (2); tshLength is selected in Options.
@rec_type
XML representation: The rec_type attribute.
Writing: Stores the literal text “TTextShadeRec” when ComboType is one of [cfsNone, cfsText].
Writing: Stores the literal text “TComboTextShadeRec” when ComboType is not one of [cfsNone, cfsText].
Nested records and repeated elements
Operation |
XML location |
When it is processed |
Read self |
. |
Whenever this part of the routine is reached |
Initialization and reset values
TTextShadeRec.Initialize
Setting or temporary variable |
Initial value |
When it is assigned |
self |
Default (TTextShadeRec) |
Always |
State |
qcbGrayed (2) |
Always |
ColorName |
an empty string |
Always |
Shade |
100 |
Always |
Opacity |
100 |
Always |
Top |
0 |
Always |
Bottom |
0 |
Always |
Left |
0 |
Always |
Right |
0 |
Always |
ClipToBox |
false |
Always |
Value namespaces used by this implementation
These are declared Pascal ordinal values. Use the ordinal only where the field serializer actually writes ord(...), an integer cast or an equivalent value. Set-marker strings and local option lists have their own representation; sentinel members in an enum are not automatically legal XML choices.
TqppCheckBoxState
Ordinal |
Declared member |
0 |
qcbUnchecked |
1 |
qcbChecked |
2 |
qcbGrayed |
TRulesLength
Ordinal |
Declared member |
0 |
qrlIndents |
1 |
qrlText |
2 |
qrlColumn |
TCombinedFrameShadeType
Ordinal |
Declared member |
0 |
cfsNone |
1 |
cfsText |
2 |
cfsBoxCreate |
3 |
cfsBoxKeep |
4 |
cfsBoxModify |
5 |
cfsBoxDelete |
TTextShadeOptions
Ordinal |
Declared member |
0 |
tshClipToBox |
1 |
tshLength |
2 |
tshColor |
3 |
tshShade |
4 |
tshOpacity |
5 |
tshTop |
6 |
tshBottom |
7 |
tshLeft |
8 |
tshRight |
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.
Name |
Declared type / bounds |
Kind |
ClipToBox |
boolean |
member |
FColorName |
array [1..50] of Char |
member |
Length |
TRulesLength |
member |
Opacity |
double |
member |
Options |
set of TTextShadeOptions |
member |
Shade |
double |
member |
State |
TqppCheckBoxState |
member |
Top |
double |
member |
Bottom |
double |
member |
Left |
double |
member |
Right |
double |
member |
ColorName |
string |
property/accessor |
The Implementation toggle contains only TTextShadeRec methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.
Declaration reproduces this record’s complete declaration from the supplied source, including its fields, properties and method signatures.