Formatting for RichText objects within the DataWindow object

Each type of object in a RichText DataWindow object has its own dialog box. When you select Properties from the pop-up menu, the dialog box you get depends on what is selected.

Properties and Control List views

The Properties and Control List views are not available for RichText DataWindow objects. The painter uses the same property sheets as are available to users when they run the DataWindow object, and controls in RichText DataWindow objects cannot be manipulated in the same way as in other DataWindow objects.

Most of the objects in a RichText DataWindow object correspond to familiar objects like bitmaps, columns, and computed fields. You can also specify formatting for a temporary selected text object. In a RichText DataWindow object, the objects are:

  • The whole document

  • Selected text and paragraphs

  • Input fields (associated with columns or computed fields)

  • Pictures

This section describes how to select each type of object and access its dialog box. The user can access the property sheets too if you enable the Popup Menu option on the Rich Text Object's General dialog box.

The whole RichText DataWindow

Settings for the whole RichText DataWindow object include the values you specified in the wizard, as well as:

  • Whether pictures are displayed or represented by empty frames

  • Whether newly entered text will wrap within the display

  • Whether various nonprinting characters, such as tabs, returns, and spaces, are visible

  • Standard DataWindow object settings such as units of measurement and the pointer

  • Print specifications

Use the following procedure to change settings:

To set values for the RichText DataWindow object

  1. Make sure nothing is selected in the Design view by clicking to set the insertion point.

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

  3. Click Help to get more information about a specific setting.

Selected text and paragraphs

You can specify detailed font formatting for selected text. The selected text can be one character or many paragraphs.

If an input field is part of the selection, the font settings apply to it, too. A picture that is part of the selection ignores settings for the selected text object.

To specify formatting for selected text

  1. Select the text you want to format.

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

    The Selected Text Object dialog box displays. You can set:

    • Paragraph alignment

      The alignment setting on the Selected Text page applies to all paragraphs in the selection.

    • Font formatting

      Settings on the Font page apply to text in the selection, including input fields.

Paragraphs

There are also settings for selected paragraphs. You can display the Paragraph dialog box by pressing Ctrl+Shift+S. The user can double-click the ruler bar or press the key combination to display the same dialog box.

Default font

The user can change the default font by double-clicking on the toolbar or pressing Ctrl+Shift+D. You cannot change the default font in the painter.

Input fields

An input field can be either a column or a computed field. Before you retrieve data, its value is shown as two question marks (??).

The text can include many copies of a named input field. The same data will appear in each instance of the input field.

Column input fields

The columns you select for the DataWindow object become input fields in the rich text. Because the input field's name matches the column name, PowerBuilder displays the column's data in the input field.

If an input field exists in the text, you can copy and paste it to create another copy. If you need to recreate a column input field that you deleted, use this procedure.

To insert a column input field in the text

  1. Select Insert>Control>Column from the menu bar.

  2. Click in the text where you want the column input field to appear.

    PowerBuilder displays a list of the columns selected for the DataWindow object.

  3. Select a column for the input field.

Properties for input fields

You select an input field by clicking inside it. A computed input field is selected when the whole field is highlighted.

To set properties for an input field

  1. Click in the input field in Design view.

  2. Display the pop-up menu and select Properties.

  3. On the Font page, specify text formatting.

  4. On the Format page, specify a display format.

  5. On the Validation page, specify a validation rule for the column.

    If there are multiple copies of an input field, the validation and format settings apply to all the copies. Background color on the Font page applies to all input fields. Other settings on the Font page apply to individual instances.

    The user cannot change the format or validation rule. At runtime, these pages are not available in the dialog box.

Computed field input fields. When you display the dialog box for a computed field, the settings are a little different. You can specify the input field name and its expression on the Compute page and there is no validation.

Data Value in preview. For both columns and computed fields, you see a value in the Data Value box when you preview the DataWindow object. The user sees a value in the Data Value box when the current row has a value. For columns, users can change the value.

Computed fields

Computed fields have an expression that specifies the value of the computed field. In rich text, they are represented as input fields, too. You specify a name and an expression. The data value comes from evaluating the expression and cannot be edited.

To define a computed field:

  1. Select Insert>Control>Computed Field.

    Predefined computed fields

    You can also select one of the predefined computed fields at the bottom of the menu. PowerBuilder provides several predefined computed fields, but in a RichText DataWindow object, only the page number (Page n of n) and today's date (Today()) are available.

  2. Click in the text where you want the computed field to appear.

    If you do not select a predefined computed field, PowerBuilder displays the dialog box for the computed field:


  3. On the Compute page, name the computed field and specify its expression.

  4. (Optional) On the Font page, specify text formatting.

  5. (Optional) On the Format page, specify a display format.

    If there are multiple copies of a computed field input field, the expression and format settings apply to all the copies. Font settings apply to individual instances. For more about computed field expressions and display formats, see Enhancing DataWindow Objects.

Pictures

Inserting a picture

You can include bitmaps (BMP, GIF, JPG, RLE, or WMF files) in a RichText DataWindow.

To insert a picture in the rich text

  1. Select Insert>Control>Picture from the menu bar.

  2. Click in the text where you want the picture to appear.

    PowerBuilder displays the Select Picture dialog box.

  3. Select the file containing the picture.

Specifying picture size

A picture is selected when you can see a dashed outline in Design or Preview view. When the picture is part of a text selection, it displays with inverted colors.

You can change the size of a picture as a percentage of the original picture size. The allowable range for a size percent change is between 10 and 250 percent.

To specify size settings for the picture

  1. Click on the picture in the Design or Preview view so you see its dashed-outline frame.

  2. Right-click in the Design or Preview view and select Properties from the pop-up menu.

    The Rich Text - Picture Object dialog box displays.

  3. Change the percent of the original picture size in the Width and Height text boxes.

    The picture expands or contracts according to the size percentage you selected.