Inside Delphi 2006 (Wordware Delphi Developers Library)
Overview
Almost every programmer tries to create a Notepad replacement at one time or another. With everything that is available in Delphi, building a great text editor is a pretty painless experience.
The first thing that we have to do is build the basic user interface of the application. To do that, drop TMainMenu, TMemo, TStatusBar (Win32 category), and TToolbar components on the Designer Surface.
After you have added the components to the Designer Surface, select the TMainMenu component and create the File, Edit, and Format menu groups (see Figure 16-2). Don't create any menu items; we're going to use actions to implement menu commands instead.
Now select the TMemo component and do the following:
-
Rename it Editor.
-
Set the Align property to alClient to have the component fill the entire client area of the form.
-
Delete the Memo1 text from the Lines property.
-
Set the ScrollBars property to ssVertical to display the vertical scroll bar to enable the user to easily view long text files.
If you've done everything right, your Designer Surface should like the one in Figure 16-3.