Home Segments Index Top Previous Next

697: Mainline

Next, you arrange for the initializeListBox callback method to send a contents: message that provides the list box with food names obtained using a collect: message:

CalorieViewManager method definition • instance 
initializeListBox: theListBox 
  foodList := (Food collectFrom: 'c:\test\vtbls.dta'). 
  theListBox contents: (foodList collect: [:p | p name]). 

Thus, when the #getContents event occurs, in the course of creating the list box, the initializeListBox: message is sent; it, in turn, reads food information from a file, and uses that food information to set the contents of the list box.