Contents
Stop Clock Sample Help

Sample Description:  Stop Clock

Points of Interest

Operating the Stop Clock

Program Overview

Control

For Help on Help, Press F1


Stop Clock

The Stop Clock application is based on an Envelop StopClock control and serves as a good example of demonstrating the functionality associated with that particular control.

Several methods are pre-defined to provide the StopClock object with most of its basic functionality.  These include Start, Finish, Pause and Reset.  In addition, several properties such as StartTime, ElapsedTime and AccumulatedTime provide accurate time indications that are automatically created through the execution of the methods mentioned above.

To record the display of the stop clock, a Timer object named StopTimer is used to update the various time displays at various intervals of time.


Operating the Stop Clock

Starting the Stop Clock

To start the stop clock, click the Start button.  Both the Elapsed and Accumulated times are automatically updated to display their corresponding times.

Pausing the Stop Clock

Clicking the Pause button causes the Accumulated time to stop, but allows the Elapsed time to continue.

Stopping the Stop Clock

Clicking the Finish button causes the Accumulated and Elapsed time to stop.

Resetting the Stop Clock

Clicking the Reset button causes the Accumulated and Elapsed time to be reset to 0.


Program Overview

How it works

The StopClock application has a StopClock object which provides the basic timer functions.  The buttons on the form, such as Start, Pause and Finish, basically invoke corresponding functions on the StopClock object.  To see the timer display, the timer object named StopTimer is used.  The Start button enables and starts both the timer and the stopclock object.  The timer object sends out a Timeout event at specified time intervals which triggers the UpdateDisplay method.  The UpdateDisplay method basically takes the elapsed and accumulated time values from the stopclock object and update the captions of the corresponding labels.

Initializing the Program

Initializing the Stop Clock program is accomplished through the execution of the btnReset method.  This method basically stops the StopTimer timer object from running and executes the stopclock object's reset method.

Starting the Stop Clock

The Start button is used to execute the stopclock object's Start method as well as enable the timer.  Enabling the timer StopTimer is how the elapsed and accumulated times are updated.

Pausing the Stop Clock

The Pause button is used to execute the stopclock object's Pause method, which stops the AccumulatedTime property from updating.

Stopping the Stop Clock

The Finish button is used to execute the stopclock's object Finish method as well as disable the timer.  Disabling the timer StopTimer is how the elapsed and accumulated times are stopped.

Resetting the Stop Clock

The Reset button is used to execute the stopclock object's Reset method as well as disable the timer.

Changing the Display Update Frequency

Three option buttons are provided on the StopClock application which are used to change the value of the timer's Interval property.  The Interval property is how often the Timeout event is triggered.  As mentioned previously, the Timeout event is handled by a method which calls the UpdateDisplay method.  The larger the Interval, the slower the display is updated.