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.

252 Day 7<br />

The standard shortcut for Select All is Ctrl+A, so let’s add that as a shortcut for our Select All<br />

menu item:<br />

1. Choose Edit | Select All from your menu <strong>in</strong> the Menu Designer.<br />

2. Click on the ShortCut property <strong>in</strong> the Object Inspector.<br />

3. Choose Ctrl+A from the list of available shortcuts. Now the Select All menu item<br />

shows Ctrl+A next to it.<br />

That’s all you have to do; <strong>C++</strong>Builder takes care of it from there. The shortcuts function<br />

without you hav<strong>in</strong>g to write any code.<br />

Odds and Ends<br />

Let’s tie up a few loose ends to f<strong>in</strong>ish off our menu. First, we’ll turn on the Word Wrap menu<br />

item by default. This menu item is go<strong>in</strong>g to be used to turn word wrapp<strong>in</strong>g on or off. When<br />

word wrapp<strong>in</strong>g is on, the Word Wrap menu item will have a check mark next to it. When<br />

word wrapp<strong>in</strong>g is off, it will not have a check mark next to it. Click on the Word Wrap menu<br />

item and then change the Checked property to True. A check mark shows up to <strong>in</strong>dicate that<br />

the word wrap feature is on.<br />

Another th<strong>in</strong>g we need to do is change the Name property on all the menu items we <strong>in</strong>serted<br />

from a template. They were given default names, and we want to change them to more<br />

mean<strong>in</strong>gful names. Select the Edit | Undo menu item. Change the Name property from Undo1<br />

to EditUndo. Notice that you append the pop-up menu name, Edit, to the front of the menu<br />

item name and remove the 1 at the end. You can use any nam<strong>in</strong>g convention you like, but<br />

be consistent. Repeat the process for the Cut, Copy, Paste, F<strong>in</strong>d, and Replace menu items.<br />

Now move to the Help menu and modify the Name property of the Contents item to<br />

HelpContents, and that of the About menu item to HelpAbout.<br />

NOTE<br />

That about wraps up our menu. Run through the menu to check it over once more. If you<br />

f<strong>in</strong>d any errors, make the necessary changes. When you are satisfied that the menu is correct,<br />

click the close box to close the Menu Designer.<br />

You can access the Code Editor directly from the Menu Designer by<br />

double-click<strong>in</strong>g on any menu item. When you double-click a menu<br />

item, the Code Editor will display the OnClick event for that item, and<br />

you can start typ<strong>in</strong>g code. In this case, we are go<strong>in</strong>g to go back to the<br />

ma<strong>in</strong> form and do our code edit<strong>in</strong>g there.

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

Saved successfully!

Ooh no, something went wrong!