Legacy XFA radio buttons
THotPDF.ApplyXFAAsAcroForm and FlattenLoadedXFA group radio members by the native template and dataset repeat scope emitted by XFA layout
Repeated groups with the same authored name become independent parent fields, each with its own Kids, V, DV and Opt; displayed name suffixes allocate unique PDF field names after the scope identity has already been resolved
The returned field count counts layout callbacks, including each radio member, rather than counting only parent dictionaries
Each member compares its exact raw export with the selected group data value; leading and trailing whitespace, Unicode, empty exports and literal hash sequences remain exact
Empty, Off and XFAOn-prefixed exports use distinct appearance aliases whilst Opt retains the literal export; duplicate exports in the same group set RadiosInUnison
Native appearances consume actual XFA shape, mark, size, border and caption styles, including per-instance Unicode and rich-text captions, real installed regular/bold/italic programs and ordered family candidates
Set AutoFormAppearances := True to generate actual self-contained AP streams; PDF 2.0 forces these appearances, and disabled appearance generation preserves group identities and selection without embedding caption font programs
Group read-only state is stored on the parent field; member state, page and selected AP references persist with each widget
Group preparation validates every member appearance before adopting the group, then uses one graph transaction for its parent, children, native objects, fonts and touched page annotations
A preparation failure or cancellation leaves no partial group; rollback restores existing field order, page resources, annotation references and deferred font wiring so earlier page drawing and later retry remain valid
For a retry at the same document location, restore the desired current page before calling ApplyXFAAsAcroForm again; ordinary layout resumes from the current page
The transaction covers one complete radio group; previously completed unrelated fields, earlier groups and layout-created pages are outside this group transaction
Radio collection and preparation apply bounded input, field, object, glyph, font and serialised-byte checks and honour the document cancellation token; the document's existing operation and script budgets remain unchanged
The portable HPDFXFABuildRadioButtonAppearance factory prepares a detached native member graph from supplied font bytes on Windows and Linux; the legacy installed-font consumer uses Windows GDI