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.

476 Day 13<br />

for project and form files because a project file and a form file cannot have the same name.<br />

For s<strong>in</strong>gle-form applications, nam<strong>in</strong>g the project and its one form differently may seem a bit<br />

strange, but <strong>C++</strong>Builder requires it nonetheless.<br />

Beg<strong>in</strong> construct<strong>in</strong>g your Web browser form by dropp<strong>in</strong>g a TTabControl component on the<br />

top of the form. This control will list URLs as you browse them so that you can easily return<br />

to one you’ve already visited. Set the control’s Align property to alTop. This will make it<br />

expand to occupy the top of the form. Thanks to alTop, your TTabControl will always occupy<br />

the topmost region of the form, no matter how large or how small the form becomes. You<br />

can drag the TTabControl’s bottom border to size it vertically.<br />

Next, change the TTabControl component’s TabWidth property to someth<strong>in</strong>g <strong>in</strong> the neighborhood<br />

of <strong>14</strong>5 pixels. This will ensure that each tab is large enough to display simple URLs<br />

without allow<strong>in</strong>g any one tab to take up too much space. Figure 13.1 shows what your<br />

TTabControl might look like.<br />

Figure 13.1.<br />

Your Web browser<br />

form with<br />

TTabControl<br />

<strong>in</strong> place.<br />

Now that the top of the browser form is <strong>in</strong> place, let’s set up the bottom. Drop a TPanel<br />

component onto the bottom of the form and set its Align property to alBottom. As with the<br />

TTabControl component, this will cause the TPanel control to always occupy the bottom of<br />

the form, regardless of how the form is resized.<br />

Press F11 to br<strong>in</strong>g up the Object Inspector; then delete TPanel’s Caption property. Set its<br />

TabOrder property to 0. This will cause TPanel’s default component (which you’ll drop <strong>in</strong><br />

place momentarily) to be the form’s default when it first displays.<br />

After you’ve set up the TPanel, you’re ready to drop its child controls onto it. Beg<strong>in</strong> by<br />

dropp<strong>in</strong>g another TPanel component onto the first TPanel’s right edge. Set the new TPanel’s<br />

Align property to alRight and delete its Caption property. This will allow you to position<br />

controls so that they are always on the form’s far right, no matter how the form is resized.<br />

Next, drop two TBitBtn components onto the new TPanel. Set the Caption property of the<br />

first button to Go! and the Caption property of the second to Home. You can set the Glyph

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

Saved successfully!

Ooh no, something went wrong!