Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

3.2.4 Adding Support to Change the Font Size and Color at Run-time

You will now make a few simple changes to the event procedure for the Hello push button to change the font size and color in the CmStatic1 text control.

Move the mouse over the CmCommand1-Click[Scriptlet] in the left windowpane and right-click once to display a pop-up menu. Select the Edit option from the context menu that appears to bring up the PowerCOBOL editor on this event procedure.

This displays an edit session for the Click event. Alter the code as follows:

Figure 3.19 The Hello push button event procedure code with font and color changes

The code shown in Figure 3.19 also illustrates two important points:

  1. Some PowerCOBOL properties, such as "Font", contain sub-properties, such as "Size". When moving a value to or from such a property it is thus reference such as:

    "Size" Of "Font"

    Use the PowerCOBOL Help system to look up properties and verify if they have sub-properties. You will receive a compile error if you attempt to move a value to a property such as "Font" that contains sub-properties.

  2. PowerCOBOL provides a number of system constants such as POW-COLOR-GREEN to make your programming tasks easier. Use the PowerCOBOL help system to look up these constants as needed or simply to view all of the constants available to you.

Save this code change and close the Editor. Now save the project and rebuild it. Execute the application.

Feel free to experiment with the application. If you click multiple times on the Hello push button, you will notice that the text value, background color, and font size all change upon each click. You may also notice that the test does not fit nicely in the static text control. You can change this by decreasing the font size you selected, or by making the control larger.

When you are finished experimenting, quit the application by clicking on the close (X) button in the upper right corner of the window.