Guidelines for Creating Property Classes
When you work with property classes, consider these guidelines:
- You can define property classes in form and menu modules.
- After creating a property class, you can add and remove properties from
it as desired. You can add properties one at a time, or with the Copy/Paste
properties commands.
Often, you will want to remove some properties so that the class definition
contains only properties that objects you base on the class will actually inherit.
For example, you might create a property class from the definition of an existing
text item so you could apply the same font and height characteristics to other
text items. However, the new property class would also contain the X Position
and Y Position properties. Since these properties define display coordinates
that would almost always need to be overridden for each text item you base on
the class, you might want to remove them from the class definition.
When you base an object on a property class, the properties of that object are
updated as follows:
- properties for which there is a corresponding property in the property class
are updated to match the property class setting
- properties for which there is no corresponding property in the property
class are left unchanged
- When you remove properties from a property class or modify an object so
that it is no longer based on a property class, any properties that the object
was inheriting from the class revert to the default settings.
- Property classes can only inherit from other property classes.
Property classes are similar to named visual attributes, but there are important
differences you should be aware of:
- Named visual attributes define only font, color, and pattern attributes;
property classes can contain these and any other properties.
- You can change the appearance of objects at runtime by changing the named
visual attribute programmatically; property class assignment cannot be changed
programmatically.
- When an object is inheriting from both a property class and a named visual
attribute, the named visual attribute settings take precedence, and any visual
attribute properties in the class are ignored.
- However, when adding the Visual Attribute Group property to a Property class,
and then
assigning that property class to another module's item or canvas, you'll need
to add these properties to control the appearance of that module or canvas:
- Foreground Color
- Background color
- Fill Pattern
- Font name
- Font Size
- Font Weight
- Font Style
- Font Spacing
Related topic
Creating a property class