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.

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

162: // Toggle the TMemo::WordWrap property. Set the Checked<br />

163: // property of the menu item to the same value as WordWrap.<br />

164: //<br />

165: Memo->WordWrap = !Memo->WordWrap;<br />

166: EditWordWrap->Checked = Memo->WordWrap;<br />

167: //<br />

168: // If WordWrap is on then we only need the vertical scroll<br />

169: // bar. If it’s off, then we need both scroll bars.<br />

170: //<br />

171: if (Memo->WordWrap) Memo->ScrollBars = ssVertical;<br />

172: else Memo->ScrollBars = ssBoth;<br />

173: }<br />

174: //------------------------------------------------------------<br />

And Now, the Moment You’ve All Been Wait<strong>in</strong>g For<br />

After you have created the event handlers for the menu items, you are ready to run the<br />

program. Click the Run button, and the program should compile and run. If you get<br />

compiler errors, carefully compare your source code with the code <strong>in</strong> List<strong>in</strong>g 7.2. Make any<br />

changes and click the Run button aga<strong>in</strong>. You might have to go through this process a few<br />

times before the program will compile and run. Eventually, though, it will run (I promise!).<br />

When the program runs you will f<strong>in</strong>d a program that, although not 100 percent featurecomplete<br />

yet, acts a lot like W<strong>in</strong>dows Notepad. Although we have a few th<strong>in</strong>gs to add before<br />

we’re f<strong>in</strong>ished, we have a pretty good start—especially when you consider the actual time<br />

<strong>in</strong>volved up to this po<strong>in</strong>t. Figure 7.22 shows the ScratchPad program runn<strong>in</strong>g.<br />

Figure 7.22.<br />

The ScratchPad<br />

program <strong>in</strong> action.<br />

259<br />

7

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

Saved successfully!

Ooh no, something went wrong!