    |

|
White Papers -
Articles
|
|
"Creating
Synergistic Components with Delphi"
|
|
James Callan
- KOG Webzine (Page 12)
|
|
Ghostly Button Pushing
To test the macro recorder, install
TMacroRecorder on the component palette, and lay out a test form as shown in Figure
5.

The form includes three standard
TButton controls vertically stacked and aligned, placed just left of three standard
TCheckbox controls, similarly aligned. To the right of the checkboxes, place a TPanel
control, a TMemo control, a TMainMenu, and the TMacroRecorder. Define the main menu
as shown in Figure 6.

Using the property inspector, set
the controls’ properties as shown in Figure 7.
|

| Define the click events for the buttons
and checkboxes as illustrated in the table shown in Figure 8. |

| Lastly, use the menu designer to map
all the main menu options as shown in Figure 9. Run the form. |

First, select "Begin Recording"
to start recording a new macro. Next, press a couple of buttons and checkboxes, clearing
out the message dialog that appears after each click. The message dialog demonstrates
a programmer supplied OnClick event for each button and checkbox. Next, select "End
Recording" to end the macro. The recorded macro will appear on the right, displayed
inside the memo control. Select "Playback" to replay the macro as many
times as you like. You can select "Begin Recording" to record another and
restart.
This test program provides a simple illustration of what the TMacroRecorder does.
As a production program, however, it is not very interesting. We will next examine
a simple child’s game that you may find more interesting. The game, as we shall see,
is made simple because of the TMacroRecorder component. |
 
|