Initializing the widget
In the primitive visual parts that you build, you might have initialization logic that runs when the part and its widget are first created. For example, the MyShape part needs special initialization code to set its resize policy, which determines whether or not the part resizes when other parts are dropped inside it in the Composition Editor, or at run time. In this section, you'll see how to write such code. The MyShape part already inherits some of these methods, but seeing how the code is written will help you understand how to build other primitive visual parts.
When a VA Smalltalk part is created, VA Smalltalk automatically creates the part's widget. You can do any widget initialization you need by overriding the postCreationInitialization method. Create the following instance method in MyShape, in your runtime application:
postCreationInitialization
"Set the resize policy of the part so it remains a
fixed size when another part is dropped on it."
super postCreationInitialization.
self resizePolicy: XmRESIZENONE.
Notice that the superclass does all of its work first, and the initialization specific to the shape widget is done last.
Setting the resize policy to XmRESIZENONE means that the shape's widget always has a fixed size. The possible values for resize policy are as follows:
XmRESIZENONE
The part stays at a fixed size when other parts are dropped on or removed from it; it never grows or shrinks automatically.
XmRESIZEANY
The part is allowed to grow or shrink automatically when other parts are dropped on or removed from it.
XmRESIZEGROW
The part is allowed to grow (but not shrink) automatically when other parts are dropped on or removed from it.
Last modified date: 01/29/2015