Article # 659, added by Geoworks, historical record
| first | previous | index | next | last |

Why don't my instance field default values work?



Q. I'm trying to set some default values for instance data, in the
   class definition. However, the values don't seem to be assigned
   to the data.

   The instance data is a struct, declared as follows:

   @instance MetaComponentColor MCI_bgColor = {CF_NOT_SET, 0};

   CF_NOT_SET has a value of 0xff. However, when I check the instance
   data of a newly-instantiated object after META_INITIALIZE has been
   called, but before I've set MCI_bgColor, the data is set to all 0s.

A. The default values declared in the class definition will not get
   set in dynamically instantiated objects. You have to write the
   appropraite code to do it explicitly in your MSG_META_INITIALIZE.