Class ValuePort
- Namespace
- RDCore.Forms.Porting
- Assembly
- RDCore.Forms.dll
How a legacy member's values convert to its RDForms member's values: TextAlign's 1, 2 and 3 to Alignment's 0, 2 and 1, or a VB6
CheckBox's 0, 1 and 2 to False, True and Null.
public sealed record ValuePort : IEquatable<ValuePort>
- Inheritance
-
ValuePort
- Implements
- Inherited Members
Remarks
A legacy value is a number or a Boolean, as a literal in the legacy code gives it. Numbers compare by value, whatever their type,
so the Integer 1, the Long 1 and the Double 1.0 are the same value. A Boolean compares as VBA's number for it: True is
-1 and False is 0.
An RDForms value is an Int32 for a number, a Boolean, or Value for VBA's Null.
Constructors
ValuePort(IReadOnlyDictionary<object, object>, IReadOnlyDictionary<string, string>, bool)
Creates the conversion of a member's values.
public ValuePort(IReadOnlyDictionary<object, object> values, IReadOnlyDictionary<string, string> constants, bool grayedComparesWithIsNull = false)
Parameters
valuesIReadOnlyDictionary<object, object>Each documented legacy value, and the RDForms value it converts to.
constantsIReadOnlyDictionary<string, string>Each legacy constant of the member's values, and the RDForms constant or literal the code port writes for it, as VBA source text.
grayedComparesWithIsNullboolWhether the legacy value that converts to
Nullis compared withIsNull(...)in RDForms code.
Exceptions
- ArgumentException
Two of the legacy values of
valuesare the same value.
Properties
Constants
Each legacy constant of the member's values, such as vbChecked or fmTextAlignCenter, and the RDForms constant
or literal the code port writes for it, as VBA source text, such as True or 2. The names compare without
regard to case.
public IReadOnlyDictionary<string, string> Constants { get; }
Property Value
GrayedComparesWithIsNull
Whether a comparison with the legacy value that converts to Null becomes an IsNull(...) test, as
chk.Value = vbGrayed becomes IsNull(chk.Value). An assignment of that value becomes an assignment of
Null.
public bool GrayedComparesWithIsNull { get; }
Property Value
Values
Each documented legacy value, and the RDForms value it converts to.
public IReadOnlyDictionary<object, object> Values { get; }
Property Value
Methods
Convert(object?)
Converts a legacy value to its RDForms value.
public ValueConversion Convert(object? legacy)
Parameters
legacyobjectThe legacy value, such as a literal of the legacy code.
Returns
- ValueConversion
The converted value, or a result whose Diagnostic the code port reports.