[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide



Overriding a Trait Record Variable

Trait record variables are declared as constants. Therefore, after being declared, a trait record variable must not be modified or deallocated. Consequently, if the subclass you are writing requires a different implementation of a trait than its superclass, the subclass should not attempt to modify or deallocate the trait record variable of its superclass. Instead, the subclass simply needs to reinstall the trait (with XmeTraitSet) on itself.

For example, suppose you are writing a subclass of ExmString called ExmStringSubclass. As you know, ExmString installs the XmQTaccessTextual trait. Suppose that ExmStringSubclass wants a different implementation of one of the trait methods of XmQTaccessTextual than ExmString does. In this case, ExmStringSubclass would install XmQTaccessTextual on itself.


[ Previous | Next | Contents | Glossary | Home | Search ]