Table of Contents

Class ComponentClass

Namespace
RDCore.Forms.Model
Assembly
RDCore.Forms.dll

The metadata of a component class, such as RDForms.CommandButton: its type name, the properties and events it has, and how it sits on a form.

public sealed class ComponentClass
Inheritance
ComponentClass
Inherited Members

Remarks

A class has at most one property of a given name, compared without regard to case: Value is a Boolean on an OptionButton and an Integer on a CheckBox, and each class names the definition it has.

Constructors

ComponentClass(string, string, ComponentKind, IReadOnlyList<PropertyDefinition>, IReadOnlyList<EventDefinition>, IReadOnlyDictionary<PropertyDefinition, object?>?, bool, bool, bool, IReadOnlyList<MethodDefinition>?, IReadOnlyList<PropertyDefinition>?, string?, bool, IReadOnlyList<PropertyDefinition>?)

Creates a component class.

public ComponentClass(string typeName, string defaultName, ComponentKind kind, IReadOnlyList<PropertyDefinition> properties, IReadOnlyList<EventDefinition> events, IReadOnlyDictionary<PropertyDefinition, object?>? defaults = null, bool isContainer = false, bool isWindowless = false, bool hasExtent = true, IReadOnlyList<MethodDefinition>? methods = null, IReadOnlyList<PropertyDefinition>? notAvailableAtRunTime = null, string? defaultMember = null, bool hasContainer = true, IReadOnlyList<PropertyDefinition>? writableAtRunTimeOnAnRDFormsForm = null)

Parameters

typeName string

The class's qualified type name, such as RDForms.CommandButton.

defaultName string

The name a designer gives the first instance it adds, less its number, such as Command.

kind ComponentKind

What the class is to the form that holds it.

properties IReadOnlyList<PropertyDefinition>

The class's properties, in the order a designer lists them.

events IReadOnlyList<EventDefinition>

The class's events.

defaults IReadOnlyDictionary<PropertyDefinition, object>

The defaults this class gives to some of its properties in place of the definitions' own.

isContainer bool

Whether an instance can hold controls: a form, a Frame, a PictureBox.

isWindowless bool

Whether the control is drawn on its container's own surface rather than in a window of its own, as VB's Label, Image, Shape and Line are. Such a control is drawn under every windowed control of its container.

hasExtent bool

Whether an instance has a width and a height. A Timer has a place in the designer and no size, and a running program cannot see it.

methods IReadOnlyList<MethodDefinition>

The class's methods; none where it is null.

notAvailableAtRunTime IReadOnlyList<PropertyDefinition>

The properties a program can neither read nor set on an instance of this class, beyond those whose definition says so, such as the Left and Top of a Timer; none where it is null.

defaultMember string

The name of the member the class's default member stands for, as DefaultMember; none where it is null.

hasContainer bool

Whether a running program reads and sets an instance's Container, as HasContainer: ignored for a class that is not a control's. A Timer has none.

writableAtRunTimeOnAnRDFormsForm IReadOnlyList<PropertyDefinition>

The properties that VB's class makes read-only at run time and Microsoft Forms 2.0's class lets a program set: a program sets them on an instance of this class on an RDForms form, such as a TextBox's MultiLine. None where it is null.

Exceptions

ArgumentException

typeName or defaultName is empty or white space; two properties, two events or two methods share a name; a default is given for a property the class does not have, or is not a value the property can hold; notAvailableAtRunTime names a property the class does not have; writableAtRunTimeOnAnRDFormsForm names one it does not have, or one whose definition is not read-only at run time; or defaultMember is empty or white space.

Properties

ClassName

The class's name without its library, such as CommandButton.

public string ClassName { get; }

Property Value

string

DefaultMember

The name of the member the class's default member stands for, or null where the model names none: the member that a program reads and assigns through an instance itself, as Command1 = True sets a VB CommandButton's Value.

public string? DefaultMember { get; }

Property Value

string

Remarks

In a VB6 type library, the default member is a hidden member of its own, _Default, with the dispatch ID 0. The name given here is the member it reads and assigns. It may be one the class does not hold as a property, such as a DriveListBox's Drive, or one that takes an argument, such as a form's Controls (Form1("Command1")), which VB refuses with error 450 without one. The model names none for UserControl and PropertyPage.

DefaultName

The name a designer gives the first instance it adds, less its number, such as Command for Command1.

public string DefaultName { get; }

Property Value

string

Events

The class's events.

public IReadOnlyList<EventDefinition> Events { get; }

Property Value

IReadOnlyList<EventDefinition>

HasContainer

Whether a running program reads and sets an instance's Container (SetContainer(ComponentInstance, ComponentInstance?)): a control's class, except a Timer's. A root and a menu item have none.

public bool HasContainer { get; }

Property Value

bool

HasExtent

Whether an instance has a width and a height.

public bool HasExtent { get; }

Property Value

bool

IsContainer

Whether an instance can hold controls.

public bool IsContainer { get; }

Property Value

bool

IsWindowless

Whether the control is drawn on its container's surface, under every windowed control of that container.

public bool IsWindowless { get; }

Property Value

bool

Kind

What the class is to the form that holds it.

public ComponentKind Kind { get; }

Property Value

ComponentKind

Methods

The class's methods: what a program's code calls on an instance, such as SetFocus or Move.

public IReadOnlyList<MethodDefinition> Methods { get; }

Property Value

IReadOnlyList<MethodDefinition>

Properties

The class's properties, in the order a designer lists them.

public IReadOnlyList<PropertyDefinition> Properties { get; }

Property Value

IReadOnlyList<PropertyDefinition>

TypeName

The class's qualified type name, such as RDForms.CommandButton.

public string TypeName { get; }

Property Value

string

Methods

DefaultOf(PropertyDefinition)

The value an instance of this class has for property when nothing sets it: the class's own default, or the definition's.

public object? DefaultOf(PropertyDefinition property)

Parameters

property PropertyDefinition

The property definition.

Returns

object

The default value.

DefaultOf<T>(PropertyDefinition<T>)

The value an instance of this class has for property when nothing sets it.

public T DefaultOf<T>(PropertyDefinition<T> property)

Parameters

property PropertyDefinition<T>

The property definition.

Returns

T

The default value.

Type Parameters

T

The property's value type.

Event(string)

The class's event of a given name, compared without regard to case.

public EventDefinition? Event(string name)

Parameters

name string

The event's name.

Returns

EventDefinition

The event, or null when the class has none of that name.

Has(PropertyDefinition)

Whether the class has property, the definition compared by reference.

public bool Has(PropertyDefinition property)

Parameters

property PropertyDefinition

The property definition.

Returns

bool

true when the class has the property.

IsNotAvailableAtRunTime(PropertyDefinition)

Whether a program can neither read nor set property on an instance of this class: VB's 393 on a read and 382 on an assignment.

public bool IsNotAvailableAtRunTime(PropertyDefinition property)

Parameters

property PropertyDefinition

The property definition.

Returns

bool

true when the definition says so (NotAvailableAtRunTime) or the class does.

IsReadOnlyAtRunTime(PropertyDefinition)

Whether a program cannot set property on an instance of this class on an RDForms form: VB's 382 on an assignment.

public bool IsReadOnlyAtRunTime(PropertyDefinition property)

Parameters

property PropertyDefinition

The property definition.

Returns

bool

true when the property is ReadOnlyAtRunTime and the class does not make it writable on an RDForms form, as Microsoft Forms 2.0's class has it writable; or when it is not available at run time (IsNotAvailableAtRunTime(PropertyDefinition)).

IsReadOnlyAtRunTimeOnAVisualBasic6Form(PropertyDefinition)

Whether a program cannot set property on an instance of this class on a Visual Basic 6.0 form, which RDForms renders as its file describes it, with VB's library: VB's 382 on an assignment.

public bool IsReadOnlyAtRunTimeOnAVisualBasic6Form(PropertyDefinition property)

Parameters

property PropertyDefinition

The property definition.

Returns

bool

true when the property is ReadOnlyAtRunTime, as VB's class has it, or is not available at run time (IsNotAvailableAtRunTime(PropertyDefinition)).

Method(string)

The class's method of a given name, compared without regard to case.

public MethodDefinition? Method(string name)

Parameters

name string

The method's name.

Returns

MethodDefinition

The method, or null when the class has none of that name.

Property(string)

The class's property of a given name, compared without regard to case.

public PropertyDefinition? Property(string name)

Parameters

name string

The property's name.

Returns

PropertyDefinition

The property, or null when the class has none of that name.

ToString()

The class's type name.

public override string ToString()

Returns

string

The class's type name.