Lab 2
comp 125-609, Goldwasser
Tuesday, September 7, 1999
Purpose: To get some experience writing Event Handlers, and to learn specifically about events involving the changing focus and clicking on controls.
Our goal for this lab is to design a simple stop light which can be
controlled manually by the user. The program window should involve
four picture boxes, one which acts as the backdrop for the lights, and
then three rectangular lights on top of this backdrop which will be
used for the red, yellow and green lights.
Your program should have the following functionality,
A sample of a working program can be downloaded from,
www.math.luc.edu/~mhg/comp125/labs/sampLab2.exe
Advice:
At run time, your program code can assign colors by referring
to the predefined color constants: vbRed, vbYellow,
vbGreen, vbBlack, among others. (See page 58,
Comment 7 for a full list)
This program will involve use of some/all of the event handlers
Click(), LostFocus(), and GotFocus().
When a program executes, the "Tab" key switches the focus from the
current object to the next, where the default cyclical order is based
on the order in which the objects were created.
To remove an object from this cyclical order (e.g. the backdrop), you
may set the "TabStop" property to "False". Please note, such an
object is still allowed to receive the focus -- it just won't be given
the focus ever by way of the Tab key. To complete disable an object
from receiving the focus or from receiving any events, set the
"Enabled" property to "False".
When testing your program, you should assure the following:
This lab is due before leaving class today. When you have completed
the program you should do the following: