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.

246 Day 7<br />

NOTE<br />

Creat<strong>in</strong>g a Menu by Hand<br />

Although there are easier ways to create a File menu, you will create your first menu by hand.<br />

The Menu Designer always has a blank menu item that acts as a placeholder for any new menu<br />

items you create. When you first start the Menu Designer, the blank item is selected:<br />

1. Change the Name property to FileMenu.<br />

2. Click on the Caption property <strong>in</strong> the Object Inspector, type &File, and press Enter.<br />

The ampersand (&) is used to create the underl<strong>in</strong>ed character for a<br />

menu item. The underl<strong>in</strong>ed character is the accelerator the user can<br />

type, <strong>in</strong> comb<strong>in</strong>ation with the Alt key, to navigate a menu us<strong>in</strong>g the<br />

keyboard. You can put ampersands anywhere <strong>in</strong> the menu item’s text.<br />

For <strong>in</strong>stance, the customary text str<strong>in</strong>g for the Exit menu item is E&xit.<br />

All you have to do is provide the ampersands where appropriate and<br />

W<strong>in</strong>dows will take it from there.<br />

At this po<strong>in</strong>t, several th<strong>in</strong>gs happen. First, the File menu shows up <strong>in</strong> the Menu Designer.<br />

It also shows on the ma<strong>in</strong> form beh<strong>in</strong>d the Menu Designer. (Remember when we added the<br />

Bevel component to the ScratchPad ma<strong>in</strong> form to use as a spacer? Now you can see why. The<br />

bevel provides visual dist<strong>in</strong>ction between the menu and the speedbar.) The other th<strong>in</strong>g that<br />

happens is that a new, blank placeholder is added below the File menu you just created, plus<br />

a new, pop-up placeholder is created to the right of the File menu. The Object Inspector is<br />

display<strong>in</strong>g a blank MenuItem component, wait<strong>in</strong>g for you to enter the Caption and Name<br />

property values. Figure 7.19 shows the Menu Designer as it appears at this po<strong>in</strong>t.<br />

Figure 7.19.<br />

The Menu Designer<br />

and Object Inspector<br />

after the File menu is<br />

created.

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

Saved successfully!

Ooh no, something went wrong!