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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

324 Day 9<br />

No, this program doesn’t do anyth<strong>in</strong>g, but it does illustrate how you can use the Object<br />

Repository to quickly prototype an application. As time goes on, you will add your own<br />

custom objects to the Object Repository and then you can really be effective! Let’s look at<br />

that next.<br />

Add<strong>in</strong>g Objects to the Object Repository<br />

The Object Repository wouldn’t be nearly so effective a tool if you couldn’t add your own<br />

objects to it. But you can add your own objects and you should. Add<strong>in</strong>g often-used objects<br />

to the Object Repository makes you a more efficient and, therefore, a more valuable<br />

programmer. There is no po<strong>in</strong>t <strong>in</strong> re<strong>in</strong>vent<strong>in</strong>g the wheel over and over aga<strong>in</strong>. Once you have<br />

an application, a form, or another object created, save it to the Repository so that you can<br />

reuse it whenever you want. Of course, you don’t want to save every form you ever created<br />

<strong>in</strong> the Object Repository—just the ones you will reuse most often.<br />

You can set out to create an object with the express purpose of add<strong>in</strong>g it to the Repository,<br />

or you can add an object to the Repository dur<strong>in</strong>g the normal course of application<br />

development. (The term object is pretty broad, so I’ll have to use a specific example <strong>in</strong> order<br />

for this to make sense.) Let’s say that you create an About box form while creat<strong>in</strong>g an<br />

application. Suddenly it dawns on you that you’d like to save this About box to use <strong>in</strong> all your<br />

programs. After all, it has your company name, logo, and all the copyright <strong>in</strong>formation laid<br />

out just the way you like it, so it’d be a shame to have to re-create the same About box for<br />

every application you write. No problem—just add it to the Repository. To add a form to<br />

the Object Repository, first save the form (if you don’t save the form, you will be prompted<br />

to save it before cont<strong>in</strong>u<strong>in</strong>g). Next, right-click the mouse anywhere on the form and choose<br />

Add To Repository from the Form Designer speed menu. When you do, the Add To<br />

Repository dialog box is displayed, as shown <strong>in</strong> Figure 9.3.<br />

Figure 9.3.<br />

The Add To<br />

Repository dialog box.

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

Saved successfully!

Ooh no, something went wrong!