Appendix: Miscellaneous Widget-Building Tips
Here are some general widget-building tips (in no particular order):
- Never call PgSetRegion().
- Never call PtDamageWidget() from a Draw method.
- Never call Pg... functions from anywhere except the Draw method.
- You don't need to call PtDamageWidget() after calling PtRealizeWidget().
- In the modify functions, don't call the widget's Extent method directly. Instead, set Pt_WIDGET_RESIZE in the widget's Pt_ARG_FLAGS resource; the widget library will calculate the widget's extent and perform any visual cleanup at the appropriate time.
- If you must calculate the extent immediately, call PtExtentWidget(), not your widget's Extent method.
- Use PtSetResources() to set the resources of subordinate (procreated) widgets.
- Avoid calling PgFlush() - the library will call it automatically when required.
- Never call PtBkgdHandlerProcess() from a Draw method.
