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.

The <strong>C++</strong>Builder IDE Explored: Projects and Forms<br />

typical W<strong>in</strong>dows program, your ma<strong>in</strong> w<strong>in</strong>dow would have a menu. It might also have<br />

decorations such as a toolbar or a status bar. Just about anyth<strong>in</strong>g goes when you’re creat<strong>in</strong>g<br />

the ma<strong>in</strong> w<strong>in</strong>dow of your application. Each application is unique, and each has different<br />

requirements.<br />

Dialog Box Forms<br />

Forms are also used where traditional W<strong>in</strong>dows programs use dialog boxes. In fact, to the user<br />

there is no difference between a <strong>C++</strong>Builder form act<strong>in</strong>g as a dialog box and a true dialog box.<br />

Dialog boxes usually have several traits that dist<strong>in</strong>guish them from ord<strong>in</strong>ary w<strong>in</strong>dows:<br />

■ Dialog boxes are not usually sizable. They usually perform a specific function, and<br />

siz<strong>in</strong>g of the dialog box is neither useful nor desirable.<br />

■ Dialog boxes almost always have an OK button. Some dialog boxes have a button<br />

labeled Close that accomplishes the same th<strong>in</strong>g. Simple dialog boxes like an About<br />

dialog box typically have only the OK button.<br />

■ Dialog boxes may also have a Cancel button and a Help button.<br />

■ Dialog boxes typically have only the system close button on the title bar. They do<br />

not usually have m<strong>in</strong>imize and maximize buttons.<br />

■ Some dialog boxes are tabbed dialog boxes that display several tabs from which the<br />

user can choose. When a tab is clicked on, a different page of the dialog box is<br />

displayed.<br />

■ The Tab key can be used to move from one control to the next <strong>in</strong> most dialog<br />

boxes.<br />

There are certa<strong>in</strong>ly exceptions to every rule. Most dialog boxes have the usual characteristics,<br />

but some perform specialty tasks and therefore depart from the norm <strong>in</strong> one way or another.<br />

Dialog boxes <strong>in</strong> <strong>C++</strong>Builder are slightly different than <strong>in</strong> other programm<strong>in</strong>g environments.<br />

First, let’s take a look at how other programm<strong>in</strong>g environments handle dialog boxes; then<br />

we’ll look at how they are implemented <strong>in</strong> <strong>C++</strong>Builder.<br />

Dialog Boxes <strong>in</strong> Traditional W<strong>in</strong>dows Programs<br />

In a traditional W<strong>in</strong>dows program (one written <strong>in</strong> C or with one of the frameworks), a dialog<br />

box is created with a dialog box editor. In most cases, the dialog box editor is a visual tool that<br />

works somewhat like the <strong>C++</strong>Builder Form Editor. When the user is done design<strong>in</strong>g the<br />

dialog box, the visual representation of the dialog box is converted <strong>in</strong>to a dialog box def<strong>in</strong>ition<br />

<strong>in</strong> a resource script. (A resource script is a text file that is later compiled <strong>in</strong>to a b<strong>in</strong>ary resource<br />

file by the resource compiler.) To illustrate, take a look at the dialog box <strong>in</strong> Figure 6.10.<br />

187<br />

6

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

Saved successfully!

Ooh no, something went wrong!