Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using constants as property default values
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Using constants as property default values
Miscellaneous
Thread ID:
00452711
Message ID:
00452711
Views:
65
In some of our code, we have carry out certain bits of code based on a property value (eg. in our error logging routine, I log different information based on the value of a property in our error object). There are only a small set of valid values for this property and so I've #define'd the values in our header file.

However, I do not seem to be able to set the default value of a property to this constant. If I type the name into the property field, it generates code that assigns that name as a string to the property (1). If I implement it as an expression it tries to evaluate it as if it were a variable name which doesn't exist (2).

? "oError.LoggingCode : "
?? oError.LoggingCode

returns (1)

oError.LoggingCode : k_ERRLOG_DEFAULT

or (2)

oError.LoggingCode : .F.

The constant is definitely defined correctly, since the line following those above contains

? k_ERRLOG_DEFAULT

and returns

0

Can anyone tell me what I am doing wrong? If necessary I'll have to assign values to the field in the init event but that will render the ResetToDefault() function useless.

Thanks,

Rob Spencer
Quids Technology
Rob Spencer, Quids Technology
Next
Reply
Map
View

Click here to load this message in the networking platform