Home Segments Index Top Previous Next

657: Mainline

You add a when:perform: message to the createViews method to tell the graph pane when to send the callDrawMeter: message.

The when:perform: message has two arguments: the first, #display, identifies a Smalltalk event triggered, ultimately, by the operating system; the second, #callDrawMeter:, names the message to be sent to the view manager:

CalorieViewManager method definition • instance
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: 'Demonstration Window'.
  theTopPane noSmalltalkMenuBar.
  theTopPane framingRatio: (1/4 @ (3/8) rightBottom: 3/4 @ (5/8)).
  "Set up the meter pane"
  theTopPane addSubpane: theMeterPane.
  theMeterPane owner: theCalorieViewManager.
  theMeterPane noScrollBars.
  theMeterPane framingRatio: (0 @ 0 rightBottom: 1 @ 1).
  theMeterPane when: #display perform: #callDrawMeter:.