12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TIP<br />

Creat<strong>in</strong>g Applications <strong>in</strong> <strong>C++</strong>Builder<br />

When the Object Repository is <strong>in</strong> the Details view, you can click on a<br />

column header (Name, Description, Date, or Author) to <strong>in</strong>stantly sort<br />

by that category.<br />

Creat<strong>in</strong>g New Objects from the Object Repository<br />

Certa<strong>in</strong>ly the most basic use of the Object Repository is creat<strong>in</strong>g a new object us<strong>in</strong>g an object<br />

from the Repository. To illustrate, let’s create a simple application with a ma<strong>in</strong> form, an<br />

About dialog box, and a second form. Follow these steps:<br />

1. Be sure no other application is open. Choose File | New from the ma<strong>in</strong> menu. The<br />

Object Repository is displayed.<br />

2. Click on the Application icon and click OK to create a new application. A new<br />

application is created, and a blank form is displayed.<br />

3. Place two buttons on the form. Change the Caption property of one of the buttons<br />

to About... and the Caption property of the other button to Display Form2.<br />

Change the Name properties if desired.<br />

4. Choose File | New from the ma<strong>in</strong> menu. The Object Repository is aga<strong>in</strong> displayed.<br />

5. Click on the Forms tab <strong>in</strong> the Object Repository.<br />

6. Choose the About box object. Be sure that the Copy radio button is selected, and<br />

click OK to create a new About Box form. The About box is displayed. Change<br />

any properties as needed.<br />

7. Modify the About box as desired. (Enter your own <strong>in</strong>formation, change the icon,<br />

change the size and position, and so on.)<br />

8. Select File | New from the ma<strong>in</strong> menu aga<strong>in</strong>. The Object Repository is displayed<br />

for the third time.<br />

9. Click on the Forms tab and choose the Dual list box object. Click OK to close the<br />

Object Repository. A dual list box form is displayed. (I had you choose this one<br />

just so you could see it.)<br />

10. Write event handlers for the two buttons that display the About box and the<br />

second form as required.<br />

11. Compile, run, and test the program.<br />

323<br />

9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!