properties - C++ (Builder XE7) enum type property misterious behaviour -


i'm not expert in c++ need update old project embarcadero c++ builder xe7.

this code not compile (the fpfixed line):

#include <system.uitypes.hpp> ... newtext->font->pitch = fpfixed; 

where pitch is:

__property system::uitypes::tfontpitch pitch = {read=getpitch, write=setpitch, default=0}; void __fastcall setpitch(const system::uitypes::tfontpitch value); 

and

enum class declspec_denum tfontpitch : unsigned char { fpdefault, fpvariable, fpfixed }; 

error: "e2451 undefined symbol 'fpfixed'"

another 2 attempts:

newtext->font->pitch = tfontpitch.fpfixed; newtext->font->pitch = system::uitypes::tfontpitch.fpfixed; 

error both: e2108 improper use of typedef 'tfontpitch'

but - strangely - compiles, no warning:

system::uitypes::tfontpitch( fpfixed );   // yes,no assignments here unused value newtext->font->pitch = fpfixed; 

what explanation of , doing wrong here? came "solution" trial , error.

newtext->font->pitch = tfontpitch.fpfixed;
newtext->font->pitch = system::uitypes::tfontpitch.fpfixed;

you on right track this, used wrong syntax. use :: instead of .:

newtext->font->pitch = tfontpitch::fpfixed; newtext->font->pitch = system::uitypes::tfontpitch::fpfixed; 

this documented in embarcadero's docwiki:

strongly typed enums (c++0x)


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -