next up previous contents index
Next: 3. The resize() Method Up: 3. Geometry Management and Previous: 1. The initialize() Method   Contents   Index

2. The set_values() Method

set_valuesmethodIf a value changed that should cause a layout change, go ahead and recompute the preferred size. Then, just set your width/height to the computed values: the Xt Intrinisics will automatically see a change made and call XtMakeGeometryRequest() on your behalf, so (ordinarily) don't do the layout step here.

If the request is granted, the Xt Intrinsics will automatically call your resize() method; that should be where the layout is done.

Rebuttal: There may be times where this isn't true. Some resources may require a Composite widget to re-layout. When doing so, there are a few warnings that should be noted.

Unfortunately, the intrinsics do not notify a widget if the resize request wasn't honored, so there's no way to do a proper job of it unless the expose() method calls the procedure that is responsible for the layout. Needless to say, this is not good for performance. One optimization that can be made is due to the nature of XtMakeGeometryRequest() (which will be discussed later): if the widget is not managed, or the parent isn't realized, then we can be sure that the resize request will be honored. In this case, we can blithely call our layout procedure and be sure that the request will be honored.


next up previous contents index
Next: 3. The resize() Method Up: 3. Geometry Management and Previous: 1. The initialize() Method   Contents   Index
Danny Backx
2000-12-13