Xbasic

INSERT_TEXT_IN_RTF_MEMO Function

Syntax

V insert_text_in_RTF_memo(P table_pointer ,C RTF_memo_fieldname ,C text [,N position [,C fontname_size ,C fontname_color]])

Arguments

table_pointer

A pointer to the table containing the rich text memo field.

RTF_memo_fieldname

The name of the rich text memo field.

text

The text to be inserted.

position

Optional. Default = 1. The character position in the memo where the new text should appear. The beginning of the field is position 1. The end of the field is 0. Numeric

fontname_size

Optional. Font name, size in points, and style in the format: "Fontname,Size,Style". Size is an integer value. The value 0 produces 144 point type. Style is one of the following characters: "B" (bold), "I" (italic), "BI" (bold italic), or blank (normal).

fontname_color

Optional. Font color name. In the Code Editor, select Code > Insert Color Name select a color, and click OK. Click View > Settings > Database > Colors to define additional colors.

Description

Inserts text into an RTF memo field. To insert at end, set position to -1, Fontname_size is of form: "Arial,12,B".

Example

The following text was place under the button labelled "RTF Text One". The picture shows how formatted text was placed into the RTF Memo field named RTF.

dim tbl as P
tbl = table.current()
insert_text_in_rtf_memo(tbl, "RTF", "This is test text", 1, "Verdana,10,B", "Red")
rtf.refresh()
images/XB_Writing_Formatted_RTF_1.gif

The following text was place under the button labelled "RTF Text Two". Note how the insert point is defined as position 8.

dim tbl as P
tbl = table.current()
insert_text_in_rtf_memo(tbl, "rtf", "This is test text", 8, "Arial,18", "Blue")
rtf0.refresh()
images/XB_Writing_Formatted_RTF_2.gif

This script under the button labelled "RTF Text Three" inserts the current date at the beginning of the field.

dim tbl as P
tbl = table.current()
insert_text_in_rtf_memo(tbl, "rtf", dtoc(date() ), 1, "Arial,10", "Black")
rtf0.refresh()
images/XB_Writing_Formatted_RTF_3.gif

See Also