Using database data
You can make a connection between a RichTextEdit control and
a DataWindow control or DataStore object. When an input field in
the RichTextEdit control has the same name as a column or computed
column in the DataWindow object, it displays the associated data.
Whether or not the RichTextEdit control has a data source,
there is always only one copy of the rich text
content. While editing, you might visualize the RichTextEdit contents
as a template into which row after row of data can be inserted.
While scrolling from row to row, you might think of many instances of
the document in which the text is fixed but the input field data
changes.
To share data between a DataWindow object or DataStore, use
the DataSource function:
1 |
rte_1.DataSource(ds_empdata) |
Example of sharing data
If the DataWindow object associated with the DataStore ds_empdata has
the four columns emp_id, emp_lname, emp_fname,
and state, the RichTextEdit content might include
text and input fields like this:
ID: {emp_id}
Dear {emp_fname} {emp_lname}:
We are opening a new plant in Mexico. If you would like to
transfer from {state} to
Mexico, the company will cover all expenses.
Navigating rows and pages
For the RichTextEdit control, navigation keys let the user
move among the pages of the document. However, you must provide
scrolling controls so that the user can move from row to row.
You should provide Prior Row and Next Row buttons. The scripts
for the buttons are simple. For Next Row:
1 |
rte_1.ScrollNextRow() |
For Prior Row:
1 |
rte_1.ScrollPriorRow() |
If you also provide page buttons, then when the user is on
the last page of the document for one row, scrolling to the next
page moves to the first page for the next row:
1 |
rte_1.ScrollNextPage() |