Solved

setting enumerated types by integer values?

Posted on 2001-08-21
5
137 Views
Last Modified: 2010-04-06
Hiya, just a little one.  Is there anyway to set an enumerated type just by setting its ordinal value?  E.g. for:

type TEnumeratedType = (etype1,etype2,etype3);

where:

var
Enum :TEnumeratedType;

I want to set Enum:=etype1 but only by using its ordinal value of 0. ie I want to be able to effectively set Ord(Enum)=0, if you see what I mean!  Is there anyway to do this (*without* writing a conversion function that converts any given integer to the appropriate TEnumeratedType constant)?  Many thanks, P.
0
Comment
Question by:Pandora
  • 3
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6409819
? maybe

enum := TEnumeratedType(0);
0
 
LVL 17

Expert Comment

by:geobul
ID: 6409973
Yes, exactly. Hi meikl, you are fast :-)

Regards, Geo
0
 
LVL 1

Author Comment

by:Pandora
ID: 6410007
aha! yes brill, thank you once again Meikl!! P.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6410011
hi geo,

i'm not really fast, i'm sometimes a bit lucky :-))
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6410033
oops,

thanks pandora,
glad to helped you :-))

meikl ;-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 106
Magic Software info 18 144
Base1 Encode/Decode 3 90
firemonkey Android Listview Sort items 7 75
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question