Table of Contents

Class FormDescriptor

Namespace
RDCore.SDK.Workspace.Forms
Assembly
RDCore.SDK.dll

What a form module's designer declares: the form's own class and designer properties, and its controls.

public sealed record FormDescriptor : IEquatable<FormDescriptor>
Inheritance
FormDescriptor
Implements
Inherited Members

Remarks

FormDescriptor is the designer model shared by every platform component that needs to know what a form declares, whichever designer wrote it: the language server, to compose the form's class and analyse its code-behind, and a form designer (an IDE), to agree with it. Read one with Read(string?, ReadOnlyMemory<byte>).

Constructors

FormDescriptor(string, FormDesignerKind, FormControlClass, IReadOnlyDictionary<string, string>, IReadOnlyList<FormControlDescriptor>)

What a form module's designer declares: the form's own class and designer properties, and its controls.

public FormDescriptor(string Name, FormDesignerKind Kind, FormControlClass Class, IReadOnlyDictionary<string, string> Properties, IReadOnlyList<FormControlDescriptor> Controls)

Parameters

Name string

The name of the form, as its designer block names it (Begin {…} ExampleView).

Kind FormDesignerKind

The designer that wrote the form.

Class FormControlClass

The class of the form itself (MSForms.UserForm, VB.Form).

Properties IReadOnlyDictionary<string, string>

The form's own designer properties, by name (case-insensitive), as written in the module's designer block: a string value without its quotes, any other value as written, without its trailing comment.

Controls IReadOnlyList<FormControlDescriptor>

The form's controls, in the order the designer persisted them; a container's controls are its Children.

Remarks

FormDescriptor is the designer model shared by every platform component that needs to know what a form declares, whichever designer wrote it: the language server, to compose the form's class and analyse its code-behind, and a form designer (an IDE), to agree with it. Read one with Read(string?, ReadOnlyMemory<byte>).

Properties

Caption

The form's Caption designer property, or null when the designer block does not set it.

public string? Caption { get; }

Property Value

string

Class

The class of the form itself (MSForms.UserForm, VB.Form).

public FormControlClass Class { get; init; }

Property Value

FormControlClass

Controls

The form's controls, in the order the designer persisted them; a container's controls are its Children.

public IReadOnlyList<FormControlDescriptor> Controls { get; init; }

Property Value

IReadOnlyList<FormControlDescriptor>

Kind

The designer that wrote the form.

public FormDesignerKind Kind { get; init; }

Property Value

FormDesignerKind

Name

The name of the form, as its designer block names it (Begin {…} ExampleView).

public string Name { get; init; }

Property Value

string

Properties

The form's own designer properties, by name, case-insensitively (whatever comparer the given dictionary had: one that went over the wire has none).

public IReadOnlyDictionary<string, string> Properties { get; init; }

Property Value

IReadOnlyDictionary<string, string>

ShowModal

The form's ShowModal designer property, or null when the designer block does not set it. A designer writes it only when it is not its default, True.

public bool? ShowModal { get; }

Property Value

bool?

StartUpPosition

The form's StartUpPosition designer property (1 is CenterOwner), or null when the designer block does not set it or sets it to something that is not a number.

public int? StartUpPosition { get; }

Property Value

int?

State

The designer's state of the form, as the library that hosts it loads it: for a VBA UserForm, the compound file its .frx keeps (StateOf(string?, ReadOnlyMemory<byte>)), opaque here. Empty for a form whose designer keeps none, and for one read without its companion file.

public ReadOnlyMemory<byte> State { get; init; }

Property Value

ReadOnlyMemory<byte>

Remarks

What a form declares is read from it once (Controls); the state itself travels with the descriptor so that whatever runs the form - the environment host, which has no file of the workspace - can hand it to the form host as it is.

Methods

AllControls()

Every control of the form, at any depth, in the order the designer persisted them.

public IEnumerable<FormControlDescriptor> AllControls()

Returns

IEnumerable<FormControlDescriptor>

DeclaredControls()

The controls the form's class has a field for, one per name, in the order the designer persisted them.

public IEnumerable<FormControlDescriptor> DeclaredControls()

Returns

IEnumerable<FormControlDescriptor>

Remarks

Every control is one, at any depth: the controls of a Frame and of a MultiPage's pages are fields of the form, like the form's own (UserForm1.OptionButton1). The pages of a MultiPage are not (MS-VBA: UserForm1.Page1 is "Method or data member not found", and the form's Controls collection does not have them; Excel-measured), and are reached through their MultiPage (MultiPage1.Pages("Page1")). The controls of a Visual Basic 6.0 control array share their name, which is the one field.