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.

Work<strong>in</strong>g with the Form Designer and the Menu Designer<br />

8. Change the Align property to alClient. The panel expands to fill the entire client<br />

area of the form. The panel cannot be resized <strong>in</strong> any dimension.<br />

9. Change the Align property to alNone. The panel can aga<strong>in</strong> be sized and moved.<br />

As you can see, chang<strong>in</strong>g Align to anyth<strong>in</strong>g other than alNone effectively glues the panel to<br />

one edge of the form. In the case of alClient, the panel is glued to all four edges of the form.<br />

To illustrate how different components work together, let’s build a prototype of an<br />

application that resembles W<strong>in</strong>dows Notepad.<br />

NEW TERM<br />

NOTE<br />

A prototype is an application that has the appearance of a work<strong>in</strong>g application but lacks<br />

full functionality.<br />

<strong>C++</strong>Builder is perfect for quick prototyp<strong>in</strong>g of an application. You can<br />

have the ma<strong>in</strong> screens and dialog boxes designed and able to be<br />

displayed <strong>in</strong> much less time than it would take with traditional <strong>C++</strong><br />

W<strong>in</strong>dows programm<strong>in</strong>g tools like OWL or MFC. That is not, however,<br />

to say that <strong>C++</strong>Builder is just for prototyp<strong>in</strong>g. <strong>C++</strong>Builder is fully<br />

capable of handl<strong>in</strong>g all your 32-bit W<strong>in</strong>dows programm<strong>in</strong>g needs.<br />

Step 1: Start<strong>in</strong>g a New Application<br />

1. Choose New Application from the ma<strong>in</strong> menu. If you’re prompted to save the<br />

current project, click No.<br />

2. Change the Name property to ScratchPad.<br />

3. Change the Caption to ScratchPad 1.0.<br />

4. Choose Project | Options from the ma<strong>in</strong> menu. Click on the Application tab and<br />

enter ScratchPad 1.0 for the application’s title. Click OK to close the Project<br />

Options dialog box.<br />

Step 2: Build<strong>in</strong>g a Speedbar<br />

Most W<strong>in</strong>dows applications these days have a speedbar. Build<strong>in</strong>g a speedbar requires several<br />

steps itself. First, we’ll put a spacer at the top of the w<strong>in</strong>dow. (You’ll see the benefit of the<br />

spacer later, when we add a menu to the application.) Here we go:<br />

1. Choose a Bevel component from the Component Palette and place it on the form<br />

(it’s located on the Additional tab).<br />

2. Change the Height property to 2.<br />

3. Change the Align property to alTop. The bevel is placed along the top of the form’s<br />

client area.<br />

239<br />

7

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

Saved successfully!

Ooh no, something went wrong!