I have a boolean field which I want to set using MyField.SetValue(Self, MyValue)
. No matter what I tried, I keep getting typecast errors.
The problem is that MyValue always contains an ordinal and is not recognized as containing a boolean. I know that boolean is an enumeration, which is an ordinal, but it should still be possible to set boolean fields and properties using TValue.
I tried the following to initiate MyValue but every time MyValue.IsOrdinal = True
while MyValue.IsBoolean = False
:
MyValue := TValue.From(True);
MyValue := TValue.From<Boolean>(True);
MyBool := True; MyValue := MyValue.From(MyBool);
MyBool := True; MyValue := MyValue.From<Boolean>(MyBool);
MyValue := True;
MyBool := True; MyValue := MyBool;
MyBool := True; TValue.Make(@MyBool, TypeInfo(Boolean), MyValue);
Is there a way to get the TValue to accept that it contains a boolean i.s.o. an ordinal so that MyField.SetValue(Self, MyValue)
will succeed?
Thanks in advance,
Decolaman