![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
ViewManager
, TopPane
, and
GraphPane
classes.
then define a createViews
method for the view-manager class,
such as the following:
createViews | theCalorieViewManager theTopPane theMeterPane | theCalorieViewManager := self. theTopPane := TopPane new. theMeterPane := MeterGraphPane new. "Set up the top pane" theCalorieViewManager addView: theTopPane. theTopPane owner: theCalorieViewManager. theTopPane labelWithoutPrefix: a title string. theTopPane noSmalltalkMenuBar. theTopPane framingRatio: a rectangle. "Set up the meter pane" theTopPane addSubpane: theMeterPane. theMeterPane owner: theCalorieViewManager. theMeterPane noScrollBars. theMeterPane framingRatio: a rectangle. theMeterPane when: #display perform: #a view-manager method.
then define the method for the view manager named by the when:perform:
message:
the view-manager method named by when:perform: thePane thePane a graph pane method.
and then define a drawing method for the graph pane:
the graph pane method ...
the graph pane method | thePen | thePen := self pen. ...
lineFrom:to:
message
to the pen:
the pen lineFrom: start point to: end point
displayText:at:
or
the centerText:at:
message to the pen:
the pen displayText: a string at: a point the pen centerText: a string at: a point