Symptom
Don’t know how to specify an internal link parameter by using the RichTextEdit control's new feature TextFieldSetTypeAndData. This is an example for reference.
Environment
PowerBuilder 2022 and later
Cause
No Target Name is associated with the TextField value inserted in the RichTextEdit control.
Resolution
Below is the demo code to demonstrate this new feature:
1. On the opened RichTextEdit control page1, click the button “1. TextFieldInsert” to insert TextField “Field01”.
Demo code: ii_id= rte_1.TextFieldInsert("Field01")
2. On page2, click the button “2. TargetInsert” to insert Target Name “Page01”.
Demo code: il_target_id= rte_1.TargetInsert("Page01",false)
3. Click the button “3. TextFieldSetTypeAndData” to associate TextField “Field01” with Target Name “Page01”.
Demo code: li_rtn = rte_1.TextFieldSetTypeAndData (ii_id,"internallink","Page01")
4. At this time, when you click the content of "Field01" with your mouse, the input cursor position will automatically move to the page2 position.
5. Alternatively, you can click anywhere else and jump to the newly set Target Name "Page01" by clicking the button "4.TargetGoto (ID)" or "4.TargetGoto (Name)".
Demo code: li_rtn = rte_1.TargetGoto(il_target_id) Or li_rtn = rte_1.TargetGoto("Page01")
Diagram of how the demo code works: