In addition to customizing the appearance of your class, you might also want to customize its behavior. The behavior, or interaction between your UI and the rest of your application is generally controlled with callbacks in Motif, and with event methods in Java. For more information, see Callback Procedures and Event Methods .
As you build your classes, you build a great deal of functionality into your UI classes using the callbacks and event methods for the class elements and the methods, (public, private, and protected) for the class itself.
You can give instances of a class access to the callbacks or event methods of its elements by exposing them just as you would any other resource. The process with which you do this is identical regardless of the language you are using. The results, however, differ slightly.
In ViewKit, it is better practice to use ViewKit's callback mechanism, provided by VkCallbackObject, rather than exposed callback resources.
To expose a callback or event method, follow these steps:
1. Switch the Browser to Classes view.
2. Update the Resource Editor for the desired component object.
3. Scroll the Resource Editor to the desired callback or event method.
4. Set the resource to the value that you want each instance to take by default.
5. Select Expose from the option menu to the right of the resource text field.
With Motif, you can choose whether the instance callback routine augments or replaces the class's exposed callback. This is controlled by the Remove Overridden Exposed Callbacks toggle on the Code Generation tab of the Code Generation Preferences dialog (Browser:Options). Refer to Toggle options for more information.
Callbacks for class members (Motif) are generated in source code as two separate methods, described in detail in
See Using Callbacks in C++ Classes for detailed information on these methods.
| Up | Previous | Next |