Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Converting enumerated type values into strings Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
02-Jan-04
Category
Object Pascal-Strings
Language
Delphi 2.x
Views
117
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Igor Siticov

How to convert font style values into string values?

Answer:

For converting enumerated type values into string we should use the GetEnumName 
function from TypInfo unit.  Below is example how to perform this action for 
TFontStyle type and for our custom type: 

1   type
2     TOurType = (otFirst, otSecond, otThird, otForth, otFifth, otLast);
3   
4   procedure TForm1.Button1Click(Sender: TObject);
5   var
6     OT: TOurType;
7     FT: TFontStyle;
8   begin
9     // TFontStyle values
10    Memo1.Lines.Add('The TFontStyle values:');
11    for FT := Low(TFontStyle) to High(TFontStyle) do
12      Memo1.Lines.Add(GetEnumName(TypeInfo(TFontStyle), ord(FT)));
13  
14    // The custom TOurType values
15    Memo1.Lines.Add('The TOurType values:');
16    for OT := Low(TOurType) to High(TOurType) do
17      Memo1.Lines.Add(GetEnumName(TypeInfo(TOurType), ord(OT)));
18  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC