Create Field

Top  Previous  Next

 

To create a field use the procedure  InputMergeField

 

function InputMergeField(

     const FieldName: string;

     const DisplayText: string = '';

     Command: string = '';

     Format: Integer = 0;

     DisplayChar: Char = #0 //<-- obsolete parameter!

     ): TWPTextObj;

 

The parameters are:

FieldName = the name of the field. Will be stored in TWPTextObj.Name

DisplayText = the text which will be placed inside the field. Will be stored in TWPTextObj.Params. Can be modified in the editor.

Command = any text which will be stored in TWPTextObj.Source

Format = any integer which will be stored in TWPTextOnj.IParam

DisplayChar should be not used anymore.

 

The result of this function is a reference to the TWPTExtObj which marks the start of the field.

 

The display of the field markers is controlled by the property InsertPointAttr.

 

Note: WPTextObj instances can be deleted and restored at any time by the editor. It is not recommended to save the references in a list. To fill a list with reference to field objects you can use the procedure FieldGetList at any time. You can also use the 'Code' API with field objects - for example the procedure CodeListTags. (See reference, HLP)

 

WPTools 5 also supports 'form fields'. They work like merge fields but if you use a special mode in property ProtectedProp the complete text can be protected, only the text inside this form fields can be edited. To create such a filed use InputEditField.