Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

11.4 Enhancing the Clock Control

In this section you are going to enhance the clock control, by adding the current date and day of the week. You will also make use of some additional properties to enhance the appearance of the control.

Bring up PowerCOBOL and open the MyClock project containing the clock control your previously developed:

Figure 11.15 The initial clock control project

Open the ClockForm Form in the form editor. You are going to enlarge the size of the form and add an additional static text control to it. You will move the current static text control to the bottom of the form.

The new static text control you will place at the top of the form will be used to display the current day of the week and the current date. You will name this static text control "DateBox" and blank out its current caption property value to make it blank.

The bottom static text control will be the existing static text control that will continue to display the current time.

Go ahead and enlarge the form, move the current static text control down to make room for a new one above it, and add the second static text control to the top of the form as shown in figure 11.16 below.

Now move the mouse over the new static text control at the top of the form and right-click on it. Select Properties from the pop-up menu.

Click on the StaticText tab.

Delete the current text in the Caption property, so that this will not display when the form appears.

Click on the Horiz. Center and Vert. Center option buttons.

Click on the Font tab. Select the Bold option under Style.

Click on the Appearance tab. Set the BackStyle property to "0 -Transparent". Set the "BorderStyle" property to "0 - Off". Set the Appearance Property to "0 - Flat".

Click on the Common tab. Change the name of this control to DateBox. If the Replace utility dialog box appears, select OK to have it replace the name in your project.

When you are finished click on the OK button to close the Properties dialog box. The form containing the clock control should appear as follows (the outlines indicate where the static text fields are located):

Figure 11.16 The ClockForm enlarged and with a second static text control

You are now ready to update the timer control event procedure to add the current day of week and date functionality to the control.