Class FormsPortMap
- Namespace
- RDCore.Forms.Porting
- Assembly
- RDCore.Forms.dll
How one legacy library's forms port to RDForms: its types, members, events, ProgIDs, handler names and constants, and the unit its code uses. A code-porting tool reads it to rewrite the code behind a VB6 form or a VBA UserForm.
public sealed class FormsPortMap
- Inheritance
-
FormsPortMap
- Inherited Members
Remarks
The map holds data only. Each lookup compares names without regard to case, as VBA does, and takes a name with or without its
library, so TextBox and MSForms.TextBox find the same entry.
A lookup that finds nothing means the legacy name ports unchanged: RDForms has a type, member or event of that name and meaning.
Members with the same name and meaning in both libraries, such as Caption, BackColor and ListIndex, have no
entry.
A member or event every control has is held once, under ExtenderClass. A lookup on a class looks under the class first, then under ExtenderClass. A lookup does not check that the class has the member: the tool asks only about members its code uses.
Fields
ExtenderClass
The legacy class that holds the members and events every control has: Control, the extender of both libraries.
public const string ExtenderClass = "Control"
Field Value
Properties
Constants
Every legacy constant the code port rewrites, and the RDForms constant or literal it writes for it, as VBA source text. The names compare without regard to case. A member's own constants, which convert with its values, are in its Constants, and take precedence over these where the constant is that member's value.
public IReadOnlyDictionary<string, string> Constants { get; }
Property Value
Events
Every event entry, for a report.
public IReadOnlyList<EventPort> Events { get; }
Property Value
FormWindowClass
The window class of the library's forms, as code that finds a form's window gives it to user32's FindWindow:
ThunderDFrame for a UserForm; null for the VB6 map, which has none. A ported form is an RDForms window,
so the code port reports a call given this class as FindWindowThunderDFrame. Windows compares
class names without regard to case.
public string? FormWindowClass { get; }
Property Value
LegacyUnit
The unit the library's code uses for the places and sizes of controls and for mouse coordinates. A VB6 control's place is in its container's scale: see ContainerLength.
public LegacyUnit LegacyUnit { get; }
Property Value
Library
The legacy library's name, as its code qualifies a type with it: VB or MSForms.
public string Library { get; }
Property Value
MSForms
The map of the MSForms library: VBA UserForms.
public static FormsPortMap MSForms { get; }
Property Value
Members
Every member entry, for a report.
public IReadOnlyList<MemberPort> Members { get; }
Property Value
Types
Every type entry, for a report.
public IReadOnlyList<TypePort> Types { get; }
Property Value
VB6
The map of VB6's VB library: VB6 forms, UserControls and PropertyPages.
public static FormsPortMap VB6 { get; }
Property Value
Methods
ConstantOf(string)
The RDForms constant or literal a legacy constant is rewritten to.
public string? ConstantOf(string legacyConstant)
Parameters
legacyConstantstringThe constant, such as
fmBorderStyleSingle.
Returns
- string
Its RDForms constant or literal, as VBA source text, or null when the constant ports unchanged.
EventOf(string, string)
How a handler of a legacy event of a class ports.
public EventPort? EventOf(string legacyClass, string legacyEvent)
Parameters
legacyClassstringThe class that raises the event, such as
TextBoxorMSForms.UserForm.legacyEventstringThe event's legacy name, such as
ExitorQueryClose.
Returns
- EventPort
The event's entry under the class, or else under ExtenderClass; null when its handlers port unchanged.
HandlerObjectOf(string)
The object name an event handler of a legacy object is renamed to: UserForm to Form, so that
UserForm_Initialize becomes Form_Initialize.
public string? HandlerObjectOf(string legacyObject)
Parameters
legacyObjectstringThe object part of a handler's name, before its underscore.
Returns
MemberOf(string, string)
How a legacy member of a class ports.
public MemberPort? MemberOf(string legacyClass, string member)
Parameters
legacyClassstringThe class the member is used on, such as
TextBoxorMSForms.TextBox.memberstringThe member's legacy name, such as
ControlTipText.
Returns
- MemberPort
The member's entry under the class, or else under ExtenderClass; null when the member ports unchanged.
ProgIdOf(string)
The RDForms class a legacy ProgID names, as a literal given to Controls.Add.
public string? ProgIdOf(string progId)
Parameters
progIdstringThe ProgID, such as
Forms.TextBox.1orVB.TextBox.
Returns
- string
The RDForms class name to write in its place, such as
RDForms.TextBox, or null when the map has no class for it, which the code port reports as UnknownProgId.
TypeOf(string)
How a legacy type name ports.
public TypePort? TypeOf(string legacyName)
Parameters
legacyNamestringThe type's name, such as
TextBox,MSForms.TextBoxorReturnInteger.