TextFieldSetTypeAndData

Description

Sets the type and type data of the text field in a RichTextEdit control.

Applies to

RichTextEdit control

Syntax

rtename.TextFieldSetTypeAndData (integer id, string type, string typedata)

Argument

Description

rtename

The name of the RichTextEdit control in which you want to set the type and type data of the text field

id

The ID of the text field to be set

type

The type of the text field to be set. The following types are supported now (the strings are case-insensitive):

  • standard -- The standard text type to which the newly inserted text field is set by default. If type is standard, the typedata argument will be ignored.

  • externallink -- The external link that can link to the external document or URL. You can set the address of the external link by the typedata argument.

  • internallink -- The internal link that can link to a location within the current document. You can set the address of the internal link which is also the target name by the typedata argument.

typedata

A string specifying the type data of the text field.

  • If type is set to standard, the type data cannot be set in the text field and this argument will be ignored.

  • If type is set to externallink, the type data represents the address of the external link. (for example, https://www.appeon.com)

  • If type is set to internallink, the type data represents the name of an internal target.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. Returns -2 if the specified type is not supported.

If any argument's value is null, returns null.

Examples

This example inserts a text field (with a text value "Test") and sets an external link in the RichTextEdit rte_1:

integer li_rtn,li_id

li_id =  rte_1.TextFieldInsert("Test")
li_rtn = rte_1.TextFieldSetTypeAndData (li_id,"externallink","https://www.appeon.com/")
MessageBox("TextFieldSetTypeAndData",string(li_rtn))

This example inserts a text field (with a text value "Go to page2") and sets an internal link in the RichTextEdit rte_1. When you click the text "Go to page2" in page1, the cursor will automatically jump to page2.

//On the opened RichTextEdit control page1, call TextFieldInsert to insert TextField "Go to page2".
ii_id= rte_1.TextFieldInsert("Go to page2")

//On page2, call TargetInsert to insert Target "Target01".
il_target_id= rte_1.TargetInsert("Target01",false)

//Call TextFieldSetTypeAndData to associate TextField "Go to page2" with Target "Target01".
li_rtn = rte_1.TextFieldSetTypeAndData (ii_id,"internallink","Target01")

You can also move cursor to Target "Target01" by clicking anywhere.

//Jump by the target ID
li_rtn = rte_1.TargetGoto(il_target_id)

//Or jump by the target name
li_rtn = rte_1.TargetGoto("Target01")

See also

TextFieldGetType

TextFieldGetTypeData