exercise 26.3. using a key to update the display window