Home Segments Index Top Previous Next

737: Mainline

To respond properly to a request to look at a new file, the resetListBox callback method must communicate with the list box and with the meter pane. The resetListBox callback method communicates with the list box and with the meter pane using names, as explained in Chapter 35. The contents of the list box is changed, and the value in the meter is set to nil:

CalorieViewManager method definition • instance 
  | theFileDialog file | 
  (theFileDialog := FileDialog new) 
    fileSpec: '*.dta'; 
  (file := theFileDialog file) notNil 
      [foodList :=  (Food collectFrom: file). 
       (self paneNamed: 'ListBox')  
         contents: (foodList collect: [:p | p name]). 
       (self paneNamed: 'CalorieMeter')  
         setValue: nil; event: #display].