Home Segments Index Top Previous Next

802: Mainline

Usually, the viewer, or other dependent part, reaches back into the model, via a getter—defined for the model—to present the change in the display of information, as in the following example:

ModelSubclass method definition • instance 
getX ^ x. 
ViewSubclass method definition • instance 
update: aspect 
  aspect = #x 
      [Transcript show: 
        'Sample viewer responding to #x update message'; cr. 
       Transcript show:  
        'Model x value, determined in viewer, is ' 
        , self model getX printString; cr.] 
M setX: 0. 
M setY: 1. 
Sample viewer responding to #x update message 
Model x value, determined in viewer, is 0