• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Enum question


type
TMen=(Me1,Me2,Me3) ...
function ...;
var Temp:Tmen;
begin
  Temp:=me3;
  ShowMessage(intToStr(integer(Temp))) ;
end;
why does the message always give me zero ?
who can i get the real integer (item order value)
10x
Asi
0
asi
Asked:
asi
1 Solution
 
kretzschmarCommented:
hi asi,

have done a test

type
TMen=(Me1,Me2,Me3);


procedure TForm1.Button1Click(Sender: TObject);
var Temp:Tmen;
begin
  Temp:=me3;
  ShowMessage(intToStr(integer(Temp))) ;
end;

and this shows me 2


but you can also use ord instead of integer like

  ShowMessage(intToStr(Ord(Temp)));


meikl
0
 
asiAuthor Commented:
hi
u r  right !
somehow the 'watch List' show integer(Temp))) zero , but the  program get the right value ...
10x
Asi
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now