To create a list box, you alter the
createViews
method shown in Segment 664 in two
ways: you add a ListBox
instance, instead of a
MeterGraphPane
instance; and you arrange to respond to
select
and getContents
events, rather than
display
events:
CalorieViewManager method definition instance createViews | theTopPane theListBox | "Set up all panes" self addView: (theTopPane := TopPane new). theListBox := ListBox new. "Set up the top pane" theTopPane owner: self; labelWithoutPrefix: 'Demonstration Window'; noSmalltalkMenuBar; addSubpane: theListBox; framingRatio: (1/4 @ (1/3) rightBottom: 3/4 @ (2/3)). "Set up the list box pane" theListBox owner: self; when: #getContents perform: #initializeListBox:; when: #select perform: #itemSelected:.