[fpc-devel] GetEnumValue result type
Leonardo M. Ramé
martinrame at yahoo.com
Mon Apr 18 21:21:22 CEST 2011
Hi, I'm having some trouble if I want to pass an enumerated type as a function parameter, when I get that type with GetEnumValue.
For example, if I have this type:
TMyType = (mtOne, mtTwo, mtThree);
var
lMyType: TMyType;
begin
lMyType := TMyType(GetEnumValue(TypeInfo(TMyType), 'mtTwo'));
// lMyType is 1 instead of "mtTwo"
// now I pass lMyType as a parameter in a function/procedure
myFunction(lMyType);
end;
Shouln't lMyType be equal to mtTwo instead of 1?
How can I get mtTwo from GetEnumValue?
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the fpc-devel
mailing list