Rich text and the end user

All the editing tools described throughout this chapter and in the section called “Working with Rich Text” in Users Guide can be made available to your users.

What users can do

Users can:

  • Use the toolbars for text formatting

  • Use the pop-up menu, which includes using the clipboard and opening other rich text and ASCII files

  • Edit the contents of input fields

  • Interact with form fields (checkbox, combo box, date, and text fields)

  • Edit the contents of tables

  • Turn the editing tools on and off

What you can make available to users in your code

You can program an application to allow users to:

  • Insert and delete input fields

  • Interact with form fields (checkbox, combo box, date, and text fields)

  • Insert tables, columns, and rows

  • Insert pictures

  • Switch to header and footer editing

  • Preview the document for printing

If a RichTextEdit control shares data with a DataWindow object or DataStore, you can program:

  • Scrolling from row to row (you do not need to program page-to-page scrolling, although you can)

  • Updating the database with changes made in input fields

The best way for you to prepare rich text for use in your application is to become a user yourself and edit the text in an application designed for the purpose. During execution, all the tools for text preparation are available.

What the user sees

The default view is the body text. You can also show header and footer text and a print preview. To show header and footer text, you must select the HeaderFooter property in the rich text control's Properties view at design time. This value cannot be changed during execution, although if you select it at design time, you can programmatically show the header and footer text at runtime.

Header and footer text

For either a RichText DataWindow object or the RichTextEdit control, you can call the ShowHeadFoot function in a menu or button script. To display the header editing panel, you can call:

dw_1.ShowHeadFoot(TRUE)

To display the footer editing panel, you must call:

dw_1.ShowHeadFoot(TRUE, FALSE)

Inserting the current page number in a footer

The following script inserts the current page number in the footer, then returns the focus to the body of the document in the rich text control. The PAGENO field name that you insert must be entered in capital letters only:

rte_1.ShowHeadFoot(true,false)
rte_1.SetAlignment ( Center! )
rte_1.InputFieldInsert("PAGENO")
rte_1.ShowHeadFoot(false,false)

You cannot change the PAGENO field with an InputFieldChangeData call.

In the overloaded function ShowHeadFoot, the second argument defaults to TRUE if a value is not provided. Call the function again to return to normal view.

dw_1.ShowHeadFoot(FALSE)

The document as it would be printed

The user can press CTRL+F2 to switch print preview mode on and off. You can also control print preview mode programmatically.

For a RichTextEdit control, call the Preview function:

rte_1.Preview(TRUE)

For a RichText DataWindow object, set the Preview property:

dw_1.Object.DataWindow.Print.Preview = TRUE

Text elements and formatting

The user can specify formatting for:

  • Selected text

  • Paragraphs

  • Pictures

  • The whole rich text document

To display the property sheet for an object, the user can:

  1. Select the object. For example:

    • Drag or use editing keys to select text

    • Click on a picture

    • Set an insertion point (nothing selected) for the rich text document

  2. Right-click in the workspace and select Properties from the pop-up menu.

To make settings for the paragraphs in the selection:

  • Double-click on the ruler bar

    or

    Type Ctrl+Shift+S.

Modifying input fields, form fields or tables

Unless you have made the rich text object display only, the user can modify the values of input fields, form fields or tables.

To modify the value of an input field:

  1. Click the input field to select it.

  2. Right-click in the workspace and choose Properties from the pop-up menu.

    The Input Field Object property sheet displays.

  3. On the Input Field page, edit the Data Value text box.

Formatting keys and toolbars

When the toolbar is visible, users can use its buttons to format text, or they can use designated keystrokes to format text in the RichTextEdit control. For a list of keystrokes for formatting rich text, see the section called “Working with Rich Text” in Users Guide.