hola
Aqui propongo otras alternativas valida para las versiones modernas de delphi, y es utilizar directamente las funciones de la RTTI
- Forma 1:
Código Delphi
[-]
uses System.Rtti;
function MethodAsString(const Method: TIdSSLVersion): String;
begin
Result := TRttiEnumerationType.GetName(Method);
end;
function StrToMethod(const MethodName: string):TIdSSLVersion;
begin
result := TRttiEnumerationType.GetValue(MethodName);
end;
-Forma 2:
Código Delphi
[-]uses System.TypInfo;
function MethodAsString(const Method: TIdSSLVersion): String;
begin
result := GetENumName(TypeInfo(TIdSSLVersion), Ord(Method));
end;
function StrToMethod(const MethodName: string):TIdSSLVersion;
var
value:integer;
begin
value := GetEnumValue(TypeInfo(TIdSSLVersion), MethodName);
result := TIdSSLVersion(value);
end;
Y forma de utilizarlo:
Código Delphi
[-]
var
Method: string;
begin
Method := q_Correo.fieldByname('Method').asstring;
with IdSSLIOHandlerSocketOpenSSL1 do begin
SSLOptions.Method := StrToMethod(Method);
MessageDlg(format('seleccionado %s ', [MethodAsString(SSLOptions.Method)]), mtInformation, [mbOK], 0);
end;