Patryk27 napisał(a)
Ze sposobem
type
TOwoce = (Marchew, Jablko, Sliwka);
Nie ma innego wyjścia, jak if'y.
Chyba jednak jesteś w błędzie
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TypInfo;
type
{$M+} //dla RTTI
TOwoce = (Marchew, Jablko, Sliwka);
{$M-}
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function OwocToStr(Value: TOwoce): String;
begin
result:= GetEnumName(TypeInfo(TOwoce), Ord(Value));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(OwocToStr(Marchew));
end;
end.