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.

6<br />

180 Day 6<br />

Palette. Click these scroll buttons to display tabs not currently <strong>in</strong> view. Likewise, if a particular<br />

page of the Component Palette conta<strong>in</strong>s more buttons than will fit the width of the display<br />

w<strong>in</strong>dow, scroll buttons will be enabled to allow you to scroll through the available buttons.<br />

Figure 6.6 shows the Component Palette with both types of scroll buttons enabled.<br />

Figure 6.6.<br />

The Component<br />

Palette scroll buttons.<br />

The Component Palette is not terribly complicated, but a basic understand<strong>in</strong>g of its use is<br />

vital for programm<strong>in</strong>g with <strong>C++</strong>Builder. Now that we’ve f<strong>in</strong>ished with these little tasks, we<br />

can get back to the ma<strong>in</strong> topic aga<strong>in</strong>.<br />

Back on Track—A Multiple-Form<br />

Application<br />

To illustrate how <strong>C++</strong>Builder uses units, let’s create an application with multiple forms. We’ll<br />

create a simple application that displays a second form when you click a button:<br />

1. Create a new project by choos<strong>in</strong>g File | New Application from the ma<strong>in</strong> menu.<br />

2. Change the Name property to Ma<strong>in</strong>Form and the Caption property to Multiple Forms<br />

Test Program.<br />

3. Save the project. Save the unit as Ma<strong>in</strong> and the project as Multiple.<br />

4. Now place a button on the form. Make the button’s Name property ShowForm2 and<br />

the Caption property Show Form 2.<br />

5. Choose File | New Form from the ma<strong>in</strong> menu (or click the New Form button on<br />

the speed menu) to create a new form.<br />

At this po<strong>in</strong>t the new form has a name of Form1 and is placed exactly over the ma<strong>in</strong> form. We<br />

want the new form to be smaller than the ma<strong>in</strong> form and more or less centered on the ma<strong>in</strong><br />

form. Cont<strong>in</strong>u<strong>in</strong>g on, then….<br />

6. Size and position the new form so that it is about 50 percent the size of the ma<strong>in</strong><br />

form and centered on the ma<strong>in</strong> form. Use the title bar to move the new form. Size<br />

the form by dragg<strong>in</strong>g the lower-right corner.

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

Saved successfully!

Ooh no, something went wrong!