@database @node main Chapter23 "SBase Personal - 23. EDITING TEXT" @{" 23 EDITING TEXT " link 0} @{" The Text Editor Window " link 1} @{" Selecting Full Screen " link 2} @{" Closing the Text Window " link 3} @{" Managing Text Files from the Project Menu " link 4} @{" Working with Non-SBase Files " link 5} @{" Creating a New Document " link 6} @{" Entering Text " link 7} @{" Word Wrap " link 8} @{" Paragraphs " link 9} @{" Editing Text " link 10} @{" Moving the Insertion Point " link 11} @{" Basic Editing Controls " link 12} @{" Reformatting " link 13} @{" Deleting Small Areas of Text " link 14} @{" Cut and Paste " link 15} @{" Mark Block " link 16} @{" Clear Block " link 17} @{" Cut " link 18} @{" Copy " link 19} @{" Paste " link 20} @{" Cut, Copy and Paste with Other Files " link 21} @{" Cut, Copy, Paste Key Equivalents " link 22} @{" Inserting Text " link 23} @{" Insert " link 24} @{" Typeover " link 25} @{" Inserting New Lines " link 26} @{" Document Layout " link 27} @{" Showing the Ruler Settings " link 28} @{" Altering the Ruler Settings " link 29} @{" Multiple Rulers " link 30} @{" Example " link 31} @{" Setting Margins " link 32} @{" Text Styles " link 33} @{" Search and Replace " link 34} @{" Search " link 34} @{" Repeating a Search " link 35} @{" Replace " link 36} @{" Control Key Equivalents " link 37} @endnode @node 0 23 EDITING TEXT The Text Editor is suitable for entering and editing text of almost any kind, from short memos and letters to lengthy written reports. Both SBase 4's SBT text files and ASCII/ANSI text files are supported. The Text Editor is not, however, intended as a replacement for a word processing program, and it does not provide all the features you would expect to see in a word processor. But you may find it more convenient to use the Text Editor for many of your word processing requirements. More specifically, it is used for two purposes relating to SBase 4 itself: - Creating form letters for Mail Merge applications (see Chapter 25). - Storing text items which are longer than the maximum length of a text field as external text files linked to database records. Note Throughout this chapter, we use the term `document' to refer to the text in memory, and the term `text file' to refer to a file on disk. To invoke the Text Editor, select the Text Editor command from the Utilities menu (or press AMIGA+H). SBase 4 opens a window in the right-hand part of the screen. @endnode @node 1 The Text Editor Window This is the text window where you enter text and edit it. Four menus are now available: Project, Edit, Search, and Options. The database window showing the current record remains open but is now inactive. If you move the mouse pointer anywhere in the database window and click in it, the window will become active again. SBase 4 lets you switch between the Text Editor and the database at any time simply by clicking in their respective windows. *** @{" See Fig 23-1 " system "ps sb2:fig23-1"} *** If you are editing a large document, the text window will only show part of it. The scroll bars or direction keys enable you to move the window in any direction over different parts of the document (see Scrolling the Text Window). The maximum width for text is 240 characters. @endnode @node 2 Selecting Full Screen If you prefer to edit text using the full width of the screen, click the Maximize box (the third small box from the right at the top of the text window). @endnode @node 3 Closing the Text Window To close the text window, either click in the box at the top left-hand corner of the text window or select the Exit command on the Project menu. This does not remove text from the computer's memory. If you open the text window later, any text you have entered will still be there. @endnode @node 4 Managing Text Files from the Project Menu Many of the Project menu commands are the same as the Project menu commands in the database window. The difference is that they operate on text files rather than database files. Most of the time, you will be working with text files you have created in the Text Editor. These are stored on disk as files with a SBT extension. Requesters which present lists of filenames show only SBT unless you alter the file name pattern (see Working with Non-SBase files, below). Here's a list of the Project menu commands, together with a brief explanation of their functions: New Clears any existing text from memory. Open Loads a text file into the Text Editor from disk. If a document is already present it will be replaced by the new file. Close Clears a document from memory and closes the text window. Save Saves a document as a text file on disk. Save as Saves a named document as a text file on disk giving you the opportunity to rename it. Remove Removes a text file from disk. Print Prints the document currently in memory. See 24 Printing Text. Exit Closes the Text Editor window and returns the user to the Database window. Does not clear the current document. @endnode @node 5 Working with Non-SBase Files You can choose to work with non-SBase text files rather than SBase SBT files. You can tell SBase to open or save any file as ASCII (or ANSI if you have selected the ANSI File Conversion option in the System Options requester). To open a non-SBase text file, follow this procedure: 1. Select Open File. 2. In the Text box, delete the SBT extension in the pattern matching string. 3. Type in the extension for the file you wish to open. Alternatively, to view all the files in the current directory, type in the asterisk character. 4. Select the file you wish to open, and click OK. - If the file is not readable as ASCII, SBase informs you. When the Text Editor has a non-SBase document in memory, the Reformat, Ruler, Margins, Underline, and Italic menu options are disabled. If you wish to save an SBT file as an ASCII or ANSI file: 1. Select Save as from the Project menu. 2. Delete the SBT extension and type in a different extension (e.g. TXT). 3. Click OK. When you convert an SBT file to ASCII or ANSI in this way, SBase removes all the formatting information - word wrapping, margin settings and text styles - from the file. @endnode @node 6 Creating a New Document When you enter the Text Editor for the first time in a session, you will be presented with a blank page. You can start typing immediately. If you already have a document in the editor, you should follow these steps: 1. Select the File New command. - If the current document has been modified since it was last saved, you will be asked to confirm that you want to go ahead. 2. When the screen is cleared, start typing. @endnode @node 7 Entering Text Text can only be typed in when the Text Editor insertion point is on the screen. The insertion point is a vertical line which shows where the next character you type will appear. If you have just started a new document, the insertion point will be at the top left-hand corner of the text window, at column 5, which is the default left ruler margin. If the insertion point is not on screen, you can click in the text window to bring it back. You cannot obtain an insertion point below the last line of text. @endnode @node 8 Word Wrap The Text Editor allows you to specify where lines of text start and finish by setting the left and right margins. In a later section, we explain how you can alter the margins for the whole document or each individual paragraph. By default, the left margin is at column 5 and the right margin is at column 75. If you type a word that extends beyond the right margin, the Text Editor automatically moves the word to start of the next line. This is known as `word wrap.' The insertion point is also moved to the next line so you can carry on typing without interruption. @endnode @node 9 Paragraphs On a typewriter, you usually need to press the ENTER key when you reach the end of a line. In the Text Editor, you use the ENTER key to end a paragraph. Pressing ENTER takes the insertion point to the start of a new line and a new paragraph. The Text Editor uses a small black rectangle as a paragraph marker to indicate the line where a paragraph ends. Paragraph markers are placed on the right-hand edge of the text window. @endnode @node 10 Editing Text The Text Editor provides a large number of facilities for editing text, ranging from insert or typeover options to Cut, Copy and Paste. @endnode @node 11 Moving the Insertion Point With the Text Editor, you can move the insertion point around the screen and edit text at any point on the screen. You can use the mouse to position the insertion point within the text window. Move the pointer to the point where you want to the insertion point to be, and click once. You cannot move the insertion point beyond the last line of text. There are two ways of bringing text into view if it extends beyond the text window. Moving the insertion point in one direction to the edge of the text window scrolls the window in the same direction. Alternatively, you can scroll the window using the pointer and the scroll bars. You may prefer not to use the mouse much while you are typing. There is a full set of keyboard equivalents for moving the Insertion Point. When you want to: Move to the left one character Move to the right one character Move up one line Move down one line Move right to the next multiple of 8 characters TAB Move left to the previous multiple of 8 characters SHIFT+TAB Move up one window height Move down one window height Move to the end of the line Move to the beginning of the line Move to the beginning of the text Move to the end of the text @endnode @node 12 Basic Editing Controls Most simple editing tasks can be performed with these controls only. Some of these tasks are explained in more detail below. Split line Join lines Switch between Insert and Typeover Undo latest edit @endnode @node 13 Reformatting The Text Editor automatically reformats the current paragraph whenever you move off the current line. It obeys the margin settings for the paragraph (see below), joins up lines, and wraps words. You can reformat the text manually by selecting the Edit Reformat command or by pressing CTRL+F. @endnode @node 14 Deleting Small Areas of Text The controls for deleting text operate on the text at the current position of the insertion point. Before using these controls, you should check that the insertion point is in fact located at the point where the text is to be deleted. When you want to: Delete the character before the insertion point BACKSPACE Delete the character after the insertion point Delete to end of word Delete to end of line Delete current line Clear current line To delete larger blocks of text, use the Cut facility as explained on the next page. @endnode @node 15 Cut and Paste SBase 4's cut and paste facilities let you cut, copy and move blocks of text within a document. Text may also be copied or moved to other documents, or between the Text Editor and database fields. The first step in a cut and paste operation is to mark the block you wish to work on so that it is highlighted on screen. @endnode @node 16 Mark Block There are four ways of marking a block: - Double-clicking. Position the mouse pointer over the first letter in the block and double-click the mouse button. Then double-click over the last letter in the block. - Click-and-drag. Click on the first letter and keep the mouse button pressed down. Then move the pointer to the end of the block and release the mouse button. The area of the block is limited by the borders of the window. If you need to mark a block larger than the window, use one of the other methods. - Control key. Position the insertion point in front of the first letter and press AMIGA+M. Repeat this step for the last letter in the block. - Edit Mark Block. Position the insertion point in front of the first letter and select the Edit Mark Block command. Repeat this step for the last letter in the block. Once a character is marked as a block, repeating the Mark Block operation can have the following results: - Before the first mark, it extends the start of the block. - After the first mark, it makes a new end to the block. @endnode @node 17 Clear Block This command removes the block markers and returns the highlighted text to its normal state. @endnode @node 18 Cut This command removes the marked block and reformats the text. The cut text is stored on the Clipboard. - Move. To move a block of text to another part of the document, first highlight the block and select Cut. Then move the insertion point to a new position in the document and select Paste. @endnode @node 19 Copy Copy stores a copy of the marked block on the Clipboard. To copy text, first select the block and select Copy. Then move the insertion point to a new position in the document and select Paste. @endnode @node 20 Paste This command inserts the text from the Clipboard at the insertion point position and reformats the text. Paste does not remove the text from the Clipboard but instead inserts a copy of it your document. This means you can use Paste to make multiple copies of the last item that was cut or copied to the Clipboard. @endnode @node 21 Cut, Copy and Paste with Other Files These commands are also available for use with database files. This means you can freely transfer data between the Text window and the Database window. See Chapter 6 Entering Data. In addition, you can transfer data between any other Workbench application which provides Cut, Copy and Paste facilities that make use of the Workbench Clipboard (provided the text format is compatible). When you select Cut or Copy, SBase 4 places the marked text in the Workbench temporary storage area known as the Clipboard. Paste then inserts the Clipboard text into the current document at the current insertion point. These operations are described in more detail below. @endnode @node 22 Cut, Copy, Paste Key Equivalents Mark Block, Clear Block, Cut, Copy and Paste are available as commands on the Edit menu. The key controls for them are as follows: Mark Block Clear Block Cut Copy Paste @endnode @node 23 Inserting Text The way text is inserted in a document depends on which one has been selected of two typing modes: Insert and Typeover. To switch between them, press CTRL+V. Provided that NUM LOCK is switched off, pressing INS also switches between Insert and Typeover modes. Insert is the default mode. Each mode has its own type of insertion point. Insert uses a thin vertical line, Typeover uses a thicker vertical line. Both modes let you add text to the end of a document, creating new lines as you do so. The difference comes when you enter text within a document. @endnode @node 24 Insert With Insert mode, you can insert text in a document without overwriting the existing text. Any text in front of the insertion point is pushed to the right to make room for the new text. At the same time the Text Editor reformats the rest of the paragraph so that it does not extend beyond the right margin. Pressing either ENTER or CTRL+S in Insert mode splits a line at the insertion point. The text following that point becomes a new paragraph. To join two paragraphs together, either position the insertion point at the start of the second paragraph and press the Backspace key, or position the insertion point anywhere on the last line of the first paragraph and press CTRL+A. @endnode @node 25 Typeover In Typeover mode, the characters you type in replace the existing characters at the insertion point. Use this mode when you want to rewrite a line or a paragraph. It saves you the trouble of having to delete old text after typing new text. Pressing ENTER in Typeover mode moves the insertion point down to the start of the next line. Pressing CTRL+S in Insert mode splits a line at the insertion point. The text following that point becomes a new paragraph. To join two paragraphs together, either position the insertion point at the start of the second paragraph and press the Backspace key, or position the insertion point anywhere on the last line of the first paragraph and press CTRL+A. @endnode @node 26 Inserting New Lines To insert new text in an existing paragraph, position the insertion point where you want the new text to appear and type the new text. To insert a new paragraph, position the insertion point at the end of an existing paragraph, press ENTER and type the new text. @endnode @node 27 Document Layout The layout of a document refers to the way it is arranged on a page, in terms of the left margin, the right margin and the line length. When you create a new document, the Text Editor has default left and right margin settings of 5 and 75, giving a maximum line length of 70 characters. The left margin specifies the first position in which you can type a character at the beginning of a line, and the right margin specifies the first position in which you cannot type a character at the end of a line. To control the document layout, the Text Editor uses a ruler line. You can set a ruler line for each paragraph in the document if you wish. All ruler settings are stored within SBase 4 SBT files. @endnode @node 28 Showing the Ruler Settings Initially, the ruler line is not visible. You can display it on screen by selecting the Ruler command from the Options menu. When you do this the ruler line appears at the top of the text window. The angled bracket at the left of the ruler indicates the current position of the left margin, the angled bracket at the right of the ruler shows where the right margin is. There are + characters along the ruler line at intervals of 8 characters. These indicate the positions where the next character may appear after TAB or SHIFT+TAB is pressed. @endnode @node 29 Altering the Ruler Settings You can move the left and right margin settings to any position on the ruler line. Place the mouse pointer on the ruler line at the point where you want to set a new margin and click the mouse button. If the pointer is nearer the left angled bracket, this action will reset the left margin; if it is nearer the right bracket it will reset the right margin. When you alter the ruler settings, the Text Editor reformats the text of the document from the current paragraph onwards to fit the new margins. Margin codes are invisibly inserted in the text at the beginning of the current paragraph. @endnode @node 30 Multiple Rulers You can assign a separate ruler line to each paragraph. The ruler line at the top of the screen reflects the margin settings for the current paragraph. You can change the margins for a single paragraph by moving the insertion point to that paragraph and then resetting the ruler. But when you do this the paragraphs following the current paragraph may also be reformatted. The point to notice is that reformatting applies to the current paragraph and any paragraphs following it which have not already had a ruler line set for them. @endnode @node 31 Example To illustrate the way multiple rulers work, let's consider an example involving a document with just four paragraphs. Initially, they all use the same ruler, the default ruler. Altering the margins for the first paragraph will have the effect of reformatting the entire document. If you reset the left margin for the second paragraph to column 30, paragraphs 3 and 4 will also be shifted to column 30. The first paragraph, however, will stay at column 5, the default setting. Next, move the insertion point to paragraph 3 and reset the ruler so that the left margin is at column 15. You will notice that this action reformats paragraphs 3 and 4 but leaves the other two paragraphs unchanged. Finally, return the insertion point to the second paragraph and position the left margin at column 40. Because paragraphs 3 and 4 no longer use the same ruler, this operation affects only the second paragraph. @endnode @node 32 Setting Margins The Margins command on the Options menu supplements the ruler setting. When you select this command, SBase 4 presents a requester with three different margin control options: Current, Default, and External. For each option, you can set the left and right margin by typing its value in the Left and Right margin boxes. - Current specifies the margins for the current paragraph; that is, the margin where the insertion point is located. Setting the margins with this options is equivalent to setting the ruler for current paragraph. - Default specifies the margins for a new file. Use this option to set the margins before typing in new text. - External specifies the margins that will apply when you load a non-SBase document; for example, an ASCII or ANSI file. Files of this type do not contain any formatting information; but if you set the External margins, SBase 4 will format an external document when it is loaded into the Text Editor. The margin settings are saved in the S:SBPER4.INI file when you click OK in the Margins requester. @endnode @node 33 Text Styles Four text styles are available from the Options menu: Plain, Bold, Underline and Italic. Styles are set by selecting the appropriate menu command. @endnode @node 34 Search and Replace Search To display the `Search document' requester while running the Text Editor, select the Search option from the Search menu (or press AMIGA+?). Specify the text string that you want SBase 4 to search for. If you want to find an exact match, click in the Match Upper/Lower-case checkbox. When you click OK, SBase 4 searches forwards from the current insertion point, so if you want the whole file to be scanned you must position the cursor at the beginning of the file before you start. The insertion point is positioned at the string if it exists in the document. If it does not, SBase informs you and ends the search with the insertion point at the end of the document. @endnode @node 35 Repeating a Search To repeat a search for the most recently defined string, whether exact or not, select the Next option from the Search menu (or press AMIGA+>>). @endnode @node 36 Replace Replace allows you to replace every occurrence of a string of characters in the text with another string. You have the option of specifying an exact match for the string to be replaced, and you may also specify whether SBase should confirm changes or not before replacing a string. 1. Position the insertion point in the text before the first occurrence of the text you wish to replace. 2. Select Search Replace (or press AMIGA+=). 3. In the box headed `Search for', enter the text string you wish to be replaced. - If you require an exact match, which takes into account the difference between upper and lower case letters, click in the Match Upper / Lower-case checkbox. 4. In the `Replace with' box, enter the string which is to replace the Search string. - If you leave the Confirm changes checkbox turned on, SBase 4 checks with you before replacing each occurrence of the Search string. It first highlights the string and then displays a Replace Selection dialog which asks you for confirmation. Click Yes to proceed with the replacement, click No to skip it. Note that the dialog may be moved, allowing you to view the text. - Click the Confirm changes checkbox if you do not wish to be prompted before a string is replaced. 5. Click OK to proceed with the Search and Replace operation. Notice that the Confirm changes checkbox also appears in the Replace Selection requester. This means after any Search string has been found, you can specify that the remaining strings be replaced without any further confirmation. @endnode @node 37 Control Key Equivalents Instead of using the mouse for certain operations you may use Control key equivalents. As well as those mentioned earlier in this chapter, the following are available: Print Plain Bold Underlined Italic @endnode