User's Guide

Defining the widget class

The first step is to create a new widget class. Create this new class in your runtime application, MyRunSamplePartsApp:

  1. In the VisualAge Organizer select the runtime application and then from the Parts menu select New>Part.
  2. Enter MyCwShape for the part's class.
  3. Select Nonvisual part or Smalltalk class for the part's type.
  4. Enter CwDrawingArea for inherits from class name.

Your class definition should look like the following:

CwDrawingArea subclass: #MyCwShape
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''

You create a link between the shape part and the shape widget by overriding the cwWidgetClass class method in MyShape. Implement the following class method in MyShape.

cwWidgetClass
  "Answer the widget for this part"
  ^MyCwShape

Now that the widget class is defined, you're ready to write its Smalltalk code.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]