Home Segments Index Top Previous Next

868: Mainline

In the following definition, if the left button is pressed at the time the redButtonPressed message is sent, controlActivity enters a loop, which continues as long as the left button is pressed. When the button is released, controlActivity sends the newModelValue message, which determines where the mouse is, relative to the minimum and maximum values displayed on the meter, and computes the model's value accordingly:

MeterController method definition • instance 
controlActivity 
  self sensor redButtonPressed 
    ifTrue: [[self sensor redButtonPressed] whileTrue: []. 
             self model value: self newModelValue].