Using a RichText DataWindow object

This section discusses:

  • How scrolling differs from other DataWindow styles

  • Problems you may encounter with default values for new rows

  • What happens when the user makes changes

Scrolling

In a RichText DataWindow object, the rich text can consist of more than one page. A row of data can be associated with several pages, making a row larger than a page. In other DataWindow styles, a page consists of one or more than one row -- a page is larger than a row.

For a RichText DataWindow object, the scrolling functions behave differently because of this different meaning for a page:

  • ScrollNextRow and ScrollPriorRow still scroll from row to row so that another row's data is displayed within the document template.

  • ScrollNextPage and ScrollPriorPage scroll among pages of the document rather than pages of rows.

Page flow

As you scroll, the pages appear to flow from one row to the next. Scrolling to the next page when you are on the last page of the document takes you to the first page for the next row. The user gets the effect of scrolling through many instances of the document.

New rows: default data and validation rules

Input fields are invisible when they have no value. Before data is retrieved, PowerBuilder displays question marks (??) in fields to make them visible. For new rows, PowerBuilder assigns an initial value based on the datatype.

If you have specified an initial value for the column, PowerBuilder uses that value; if no value is specified, PowerBuilder uses spaces for string columns or zero for numeric columns.

Possible validation errors

If the default initial value provided by PowerBuilder does not satisfy the validation rule, the user gets a validation error as soon as the new row is inserted. To avoid this, you should specify initial values that meet your validation criteria.

When the user makes changes

Display only

When you check Display Only on the General property page for the Rich Text Object, the user cannot make any changes to the data or the rich text.

If you leave the pop-up menu enabled, the user can turn off the display-only setting and make the DataWindow object editable.

Input fields

In an editable DataWindow object, users change the value of a column input field by displaying the input field's property sheet and editing the Data Value text box. For a computed field input field, the Data Value text box is read-only.

You can let the user display input field names instead of data. You might do this if you were providing an editing environment in which users were developing their own RichText DataWindow object. However, the RichTextEdit control is better suited to a task like this, because you have more scripting control over the user's options.

Rich text

If users edit the text or formatting, they are changing the document template. The changes are seen for every row.

The changes apply to that session only, unless you take extra steps to save the changes and restore them.

To save the changes, you can write a script that uses the CopyRTF function to get all the text, including the named input fields but not the row data, and save the contents of that string in a file or database. Whenever users view the RichText DataWindow object, you can restore their latest version or let them return to the original definition of the DataWindow object's text.

Functions for RichText DataWindow objects

The DataWindow control has many functions.

Functions that behave the same

DataWindow control functions that operate on data, such as Update or Retrieve, have the same behavior for all types of DataWindow objects.

When the object in the control is a RichText DataWindow object, some of the functions do not apply or they behave differently.

Functions that do not apply

Some functions are not applicable when the object is a RichText DataWindow object. The following functions return an error or have no effect:

  • Functions for graph and crosstab DataWindow objects

  • Functions for grouping: GroupCalc, FindGroupChange

  • Functions for code tables: GetValue, SetValue

  • Functions for selecting rows: SelectRow, SetRowFocusIndicator, GetSelectedRow

  • Functions that affect column and detail band appearance: SetBorderStyle, SetDetailHeight

  • ObjectAtPointer

  • OLEActivate

Functions that behave differently

Some functions have different behavior when the object is a RichText DataWindow object:

  • Functions for the clipboard: Copy, Clear, and so on

  • Functions for editable text (they apply to the edit control in other DataWindow styles): LineCount, Position, SelectText, and so on

  • Find and FindNext (the arguments you specify for Find determine whether you want the general DataWindow Find function or the RichText version)

  • Scrolling