Creating Forms

TX Text Control supports creating documents that can be designed as forms. Such write-protected templates provide specific form fields to fill in, set or select custom or predefined values that complete the document with user-specific information. TextControl supports the following form fields:

  • Text form field: An object of type TextFormField can be used to provide a text range, where the user can fill in custom text.
  • Check box: Inserting a CheckFormField into the TextControl displays a check box that can be checked and unchecked.
  • Drop-down list field: Activating a drop-down list field provides a predefined list of items, where one can be chosen as the visible text. To insert such a drop-down list field into TextControl programmatically, an object of type SelectionFormField with the Editable property set to false has to be added.
  • Combo box field: An added SelectionFormField object, where the Editable property is set to true, provides a control that can be used as both a drop-down list and a text box.
  • Date form field: Using an object of type DateFormField is recommended to enter a date. Activating that field opens a date picker control where the user can select a specific date from a displayed calendar.

All these form fields can be inserted into TextControl by adding the corresponding instances to the TextControl.FormFields collection. Another way to insert, modify and/or remove form fields is to use the predefined RibbonFormFieldsTab, ribbon tab, that provides all tools to determine form field type specific settings.

Image

In order to deploy a form, the content of the document must be protected.

That can be programmatically handled by setting the TextControl.DocumentPermissions' AllowEditingFormFields and Read Only properties to true and the TextControl.EditMode property to EditMode.ReadAndSelect. The same result can be achieved by toggling the RibbonPermissionsTab's Fill in Form Fields and ReadOnly buttons to the corresponding document permissions and finally by clicking the Enforce Protection button to set the ReadAndSelect edit mode.

Image

Recognizing Form Field Value Changes

In some cases, it is useful to recognize whether the value of a specific form field changed. For such situations, TX Text Control provides the following form field type specific TextControl events that are fired when the value of the corresponding form field changed:

  • FormFieldCheckChanged: Occurs when the checkmark of the CheckFormField has been changed programmatically or manually by mouse or keyboard interaction.
  • FormFieldDateChanged box: Occurs when the date of a DateFormField has been changed programmatically, manually by selecting a new date from the activated DateFormField's date picker control or a new valid date was typed in and the DateFormField's text field is left.
  • FormFieldSelectionChanged: Occurs when the text of a SelectionFormField has been changed programmatically, manually by selecting one of its items or new text was typed in and the SelectionFormField's text field is left.
  • FormFieldTextChanged: Occurs when the text of a TextFormField has been changed programmatically or new text was typed in and the TextFormField's text field is left.