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.

6<br />

190 Day 6<br />

TIP<br />

<strong>C++</strong>Builder keeps a list of the files and projects you have used most<br />

recently. Chose File | Reopen to view the MRU (most recently used)<br />

list. The MRU list is divided <strong>in</strong>to two parts. The top part shows the<br />

projects you have used most recently, and the bottom part shows the<br />

<strong>in</strong>dividual files that you have used most recently. Just click on one of<br />

the items to reopen that project or file.<br />

First we’ll add a button to the form that will display the About dialog box:<br />

1. Br<strong>in</strong>g the ma<strong>in</strong> form <strong>in</strong>to view. Choose the button component from the Component<br />

Palette and drop a button on the form.<br />

2. Arrange the two buttons that are now on the form to balance the look of the form.<br />

3. Change the Name property of the new button to AboutButton and the Caption<br />

property to About....<br />

4. Double-click the AboutButton you just created on the form. The Code Editor is<br />

displayed with the cursor placed <strong>in</strong> the event-handler function. Add this l<strong>in</strong>e of<br />

code at the cursor:<br />

AboutBox->ShowModal();<br />

We haven’t actually created the About box yet, but when we do we’ll name it AboutBox so we<br />

know enough to go ahead and type the code to display the About box.<br />

Now we’ll create the dialog box itself:<br />

1. Create a new form (click the New Form button on the toolbar). Size the form to<br />

the size of a typical About box (roughly the same size as the form named<br />

SecondForm that we created earlier).<br />

2. Change the Name property to AboutBox and change the Caption property to About<br />

This Program.<br />

3. Locate the BorderStyle property (it’s just above Caption) and change it to<br />

bsDialog.<br />

4. Now add three text labels to the box. Edit the labels so that the About box resembles<br />

that <strong>in</strong> Figure 6.11. (You can type any text you want, of course.) You can leave<br />

the default names <strong>C++</strong>Builder generates for the text labels’ Name properties. We<br />

aren’t actually go<strong>in</strong>g to do anyth<strong>in</strong>g with the Name property, so we don’t need a<br />

descriptive name.

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

Saved successfully!

Ooh no, something went wrong!