Solved

setting enumerated types by integer values?

Posted on 2001-08-21
5
132 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now