Chapter 16: Building a Text Editor


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.

image from book
Figure 16-1: The text editor that we're going to create in this chapter

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.

image from book
Figure 16-2: Main menu groups

Now select the TMemo component and do the following:

  1. Rename it Editor.

  2. Set the Align property to alClient to have the component fill the entire client area of the form.

  3. Delete the Memo1 text from the Lines property.

  4. 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.

image from book
Figure 16-3: The basic user interface



Inside Delphi 2006
Inside Delphi 2006 (Wordware Delphi Developers Library)
ISBN: 1598220039
EAN: 2147483647
Year: 2004
Pages: 212
Authors: Ivan Hladni

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net