Home Segments Index Top Previous Next

761: Mainline

All that remains is to fill in the templates to provide the behavior you want. For example, in the decrementMeter: method—the callback method for the clicked event—you arrange to set the value, in the meter named 'the meter', to 1 less than the current value. Then, you activate the display event to redraw the meter with the new value.

GuiViewManager method definition • instance 
decrementMeter: theButton 
  | meter | 
  meter := self paneNamed: 'the meter'. 
  meter setValue: meter getValue - 1; 
        event: #display 

You define the incrementMeter callback method analogously:

GuiViewManager method definition • instance 
incrementMeter: theButton 
  | meter | 
  meter := self paneNamed: 'the meter'. 
  meter setValue: meter getValue + 1; 
           event: #display