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.

NOTE<br />

NOTE<br />

More on Projects<br />

if (!AboutBox->Handle) {<br />

AboutBox = new TAboutBox(this);<br />

AboutBox->SetParent(this);<br />

}<br />

aboutBox->ShowModal();<br />

This code checks to see if the form has already been created. If it has not, the object is created<br />

and then the ShowModal() method is called. This code also calls SetParent() to set the parent<br />

of the form to the call<strong>in</strong>g form (the ma<strong>in</strong> form, <strong>in</strong> most cases). It’s up to you to decide which<br />

method you use, but I prefer the former.<br />

Each time you create a form <strong>in</strong> the Form Designer, <strong>C++</strong>Builder creates<br />

a po<strong>in</strong>ter to the form. If you allow <strong>C++</strong>Builder to auto-create a form,<br />

you don’t have to worry about the po<strong>in</strong>ter be<strong>in</strong>g valid. If you choose<br />

not to have a form auto-created, the po<strong>in</strong>ter to the form will be NULL<br />

until you explicitly create the form and <strong>in</strong>itialize the po<strong>in</strong>ter. If you<br />

forget and use the po<strong>in</strong>ter before it is <strong>in</strong>itialized, W<strong>in</strong>dows will generate<br />

an access-violation error.<br />

Okay, so back to the Project Options dialog box. The Auto-create forms list box conta<strong>in</strong>s a<br />

list of the forms that will be auto-created. If you do not want a form to be auto-created, drag<br />

the form from the Auto-create forms list box to the Available forms list box. You can move<br />

forms from one list box to the other us<strong>in</strong>g drag-and-drop, too. To move several forms at one<br />

time, simply select the forms you want to move (both list boxes support multiple selection)<br />

and drag-and-drop them all at once. It’s as easy as that.<br />

You can use the buttons between the two list boxes to move forms from<br />

one list box to the other, but it’s usually easier to use drag-and-drop.<br />

The Application Page<br />

The Application page of the Project Options dialog box is very simple. (See Figure 10.8.)<br />

The Title field on this page is used to set the title of the application. The title is the text that<br />

will appear on the W<strong>in</strong>dows taskbar when your application is m<strong>in</strong>imized.<br />

365<br />

10

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

Saved successfully!

Ooh no, something went wrong!