Building and Executing Your To-Do List Application

Now that you have created your application, you must build the code so that you can execute the application. This process requires the following steps:

  1. Generating the Code
  2. Building the To-Do List Application
  3. Running the To-Do List Application

Generating the Code

The first step in preparing to build your application, is generating the C++ code. This two-part process includes generating the code for your part source and for the main() function.

Generating the Source Code for Your To-Do List Application Visual Part:

To generate the C++ source code for your visual part, select File, Save and generate, and Part source, or select the Part Code Generation tool on the tool bar. When the files are generated, close the Composition Editor.

VisualAge generates the following files in the working directory:

This file... Is the...
todolist.cpp C++ code for your ToDoList part.
todolist.hpp C++ header file for your ToDoList part.
todolist.h Resource header file for your todolist.cpp file.
todolist.rci Resource file for your todolist.rcx file, which will be created when you generate source code for your main() function.

Generating the Source Code for Your To-Do List Application main() Function:

To generate the source code for your main() function, you must first create a main() part.

  1. Select the Configuration tab, and in the left panel select the target path.
  2. Click the right mouse button and select Add NonVisual Part into... and the Parts SmartGuide appears.
  3. Select Next.
  4. In the Part name field enter ToDoMain and select Next.
  5. From the Base class drop-down menu, select IVBMain and select OK.
  6. Switch to the Project tab and select the Parts button.
  7. Refresh the view by clicking the right mouse button and selecting Refresh View from the pop-up menu.
  8. Select ToDoMain.
  9. In the right panel, select Edit part and the Composition Editor appears.

Next you must place the To-List part in the new ToDoMain part and make connections.

  1. Select Options and Add part.
  2. In the Class Name field, type ToDoList and select OK.
  3. Move the crosshairs to the free-form surface, click mouse button 1, and the ToDoList visual part appears.
  4. Connect the ready event of the free-form surface to the show action of the ToDoList visual part.

Select File, Save and generate, and then Part source, or select the Part Code Generation tool on the tool bar. VisualAge generates the following files in the working directory:

This file... Is the...
ToDoMain.cpp C++ code for your ToDoMain part.
ToDoMain.hpp C++ header file for your your ToDoMain part.
ToDoMain.h Resource header file for your ToDoMain.cpp file.

Building the To-Do List Application

Building your application consists of compiling and linking. To build your application, do the following:

  1. Select the ToDoMain part and click the right mouse button.
  2. Select Build from the pop-up menu.

Running the To-Do List Application

To run your application, do the following:

  1. Select the ToDoMain part and click the right mouse button.
  2. Select Run from the pop-up menu.

Once your application is running, experiment with it to make sure it works as you designed it.

You can add a finishing touch to your application by creating a program object in OS/2 or a shortcut in Windows. Once you have done this, you can run your application by simply double-clicking on the program object or shortcut you just created.

If you created the simple To-Do List and would like to create the advance application, go to Enhancing the Simple To-Do List Application.

If you would like to exit the VisualAge, go to Exiting the Composition Editor.