Share via


Display a Stop Watch

File: ...\Samples\Solution\Controls\Timer\Swatch.scx

This sample includes the Stopwatch class.

The Stopwatch Class

The Stopwatch class includes a timer and several display labels. The Timer increments numeric custom properties of the class and sets the Caption property of the labels accordingly.

The Start method of the class sets the Enabled property of the Timer to true (.T.). The Stop method sets the Enabled property of the Timer to false (.F.). And the Reset method sets the numeric properties to 0.

The Swatch Form

The Swatch form contains an object derived from the Stopwatch class, along with some command buttons. The code written for the Click event of the first command button on the form calls the Start and Stop methods of the Stopwatch class. The second button calls the Reset method of the Stopwatch class.

See Also

Stop Watch | Solutions Samples | Visual FoxPro Foundation Classes A-Z