Exercises 4.3
- Add a Find
command to the List
menu. This command will trigger the find
method when selected. The find
method prompts the user for an item and searches for it in the
list. If the item is found, the method highlights the item; otherwise,
the method displays an appropriate message.
- Add a Clear
command to the List
menu. This command will trigger the clear
method. The clear
method clears the list after first asking for confirmation from
the user. Instead of a prompter, use the MessageBox
confirm: message, which returns true
or false
based on a yes or no answer from the user.
- Use the class hierarchy browser to examine the
methods for ListPane.
Write a brief essay on the following topics:
- Forcing the selection of an item in the list
pane under program control. How could this be done when the window
is first opened?
- Referencing the items in the list pane by index
position rather than item name. How would this be done to obtain
the selected item or force its selection?