Board index » cppbuilder » Enum Lists
Kirt
![]() CBuilder Developer |
Kirt
![]() CBuilder Developer |
Enum Lists2007-12-05 04:54:37 AM cppbuilder111 not sure if i'm in the right place here. basically, i'm looking for a way to get a list of enum names. for example, the property editor for TPanel will have a drop down list of enum values by name (alLeft, alCenter, etc) for Align. can i get that list, perhaps as a TStringList, for use in my own program? |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-05 07:03:16 AM
Re:Enum Lists
"Kirt" < XXXX@XXXXX.COM >wrote in message
Quotei'm looking for a way to get a list of enum names. Quotefor example, the property editor for TPanel will have a drop down other enum-based property) and simply runs a loop, passing each numeric value in between to GetEnumName(). Quotecan i get that list, perhaps as a TStringList, for use in my own program? have to put it into a wrapper class, since enums by themselves don't have any RTTI in C++. For example: groups.google.com/group/borland.public.cppbuilder.vcl.components.using/msg/f03d3673a62c204c Gambit |
Kirt
![]() CBuilder Developer |
2007-12-05 10:34:36 PM
Re:Enum Lists
Remy Lebeau (TeamB) wrote:
Quote>can i get that list, perhaps as a TStringList, for use in my own program? {smallsort} |
Bill
![]() CBuilder Developer |
2007-12-20 05:03:52 AM
Re:Enum Lists
Remy Lebeau (TeamB) wrote:
Quote>groups.google.com/group/borland.public.cppbuilder.vcl.components.using/msg/f03d3673a62c204c compile! I just copied it form the link and it came with some funny characters. Where can I get a clean copy to try it out? Thanks |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-20 06:32:51 AM
Re:Enum Lists
"Bill" < XXXX@XXXXX.COM >wrote in message
QuoteI looked the code and 'd like to use it, but I can not get QuoteI just copied it form the link and it came with some funny characters. |
Asger Joergensen
![]() CBuilder Developer |
2007-12-20 07:15:45 AM
Re:Enum Lists
Hi Remy
Remy Lebeau (TeamB) says: Quote
the thread though. Just thought You should know. Kind regards Asger |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-20 08:00:29 AM
Re:Enum Lists
"Asger Joergensen" < XXXX@XXXXX.COM >wrote in message
QuoteMine doesn't either, I also get al kind of strange characters in that |
Asger Joergensen
![]() CBuilder Developer |
2007-12-20 11:35:38 AM
Re:Enum Lists
Hi Remy Lebeau (TeamB)
Remy Lebeau (TeamB) says: Quote
class e##_HACKED_ENUM_TYPEINFO : public TObject \ { \ private: \ e FTestEnum; \ __published: \ __property e eProp = \ |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-20 01:36:41 PM
Re:Enum Lists
"Asger Joergensen" < XXXX@XXXXX.COM >wrote in message
Quote#define DECLARE_ENUM_TYPEINFO(e) \ Gambit |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-20 01:50:53 PM
Re:Enum Lists
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
QuoteThat is how it is supposed to look. tokens have special meaning inside a #define statement. Gambit |
Asger Joergensen
![]() CBuilder Developer |
2007-12-20 02:13:10 PM
Re:Enum Lists
Hi Remy
Remy Lebeau (TeamB) says: Quote
Kind regards Asger |
Bill
![]() CBuilder Developer |
2007-12-20 10:59:35 PM
Re:Enum Lists
Remy Lebeau (TeamB) wrote:
Quote"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message if(EditFlags.Contains((TExtEditFlag)x)) TreeView2->Items->Add(NULL, GetEnumName(pTypeInfo, x)); The compiler complains EditFlags.Contains : [BCC32 Error] Unit1.cpp(95): E2294 Structure required on left side of . or .* Thanks |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-12-21 01:58:44 AM
Re:Enum Lists
"Bill" < XXXX@XXXXX.COM >wrote in message
QuoteThe only error I get is at RTTI. It was copied from a design-time editor for one of my components. TExtEditFlag is an enum, and EditFlags is a Set of TExtEditFlag values: typedef Set<TExtEditFlag, firstvalue, lastvalue>TExtEditFlags; Use whatever enums you want. The Set is optional. You could just display all of the enum values in the loop, ie: DECLARE_ENUM_TYPEINFO(TSomeEnum); PTypeInfo pTypeInfo = GET_ENUM_TYPEINFO(TSomeEnum); PTypeData pTypeData = GET_ENUM_TYPEDATA(TSomeEnum); for(int x = pTypeData->MinValue; x <= pTypeData->MaxValue; ++x) ShowMessage(GetEnumName(pTypeInfo, x)); Gambit |
Bill
![]() CBuilder Developer |
2007-12-21 02:31:26 AM
Re:Enum Lists
Remy Lebeau (TeamB) wrote:
Quote"Bill" < XXXX@XXXXX.COM >wrote in message was told to use std::map. This helps a lot! Thanks again |