Ticket Q510892
Visible to All Users

RichEditControl - Support locked fields

created 12 years ago

Is it possible to programatically lock a field in the RichEditControl so that it will not update with the document? I don't seem to be able to find anything.

In Word, this is the 'Field.Locked' property.

Thanks.

Answers approved by DevExpress Support

created 9 years ago

We have implemented the functionality described in this ticket. It will be included in our next update(s).

Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

Additional information:
  1. The DevExpress.XtraRichEdit.API.Native.Field.Locked property has been implemented. Setting the Locked property to true locks the field, so it cannot be updated automatically or by executing UI commands.
  2. The DevExpress.XtraRichEdit.FieldOptions.UpdateLockedFields property has been implemented. You can specify the property value using the RichEditControl.Options.Fields.UpdateLockedFields notation. This property can take one of three different values:
    - UpdateLockedFields.Always - all locked fields are updated when updating document fields (default behavior for v15.1)
    - UpdateLockedFields.Never - locked fields are not updated (default behavior for v15.2), and the CalculateDocumentVariable event is not raised for DOCVARIABLE fields.
    - UpdateLockedFields.DocVariableOnly - when document fields are updated, all locked fields remain intact except for DOCVARIABLE fields. If the CalculateDocumentVariable event is handled, it is raised for locked DOCVARIABLE fields. To provide new values for locked DOCVARIABLE fields, handle the CalculateDocumentVariable event.
  3. The CalculateDocumentVariableEventArgs.FieldLocked property has been implemented. It enables you to lock or unlock the field within the CalculateDocumentVariable event handler. To do so, change the value of the e.FieldLocked property and set e.Handled to true to apply changes.
  4. The DocVariableValue.Current value has been implemented. Assign it to the e.Value property within the CalculateDocumentVariable event handler to retain an existing value of the DOCVARIABLE field.
  5. Commands for locking/unlocking fields have been implemented. Select the field (place the cursor within it) and use default shortcut Ctrl+F11 to lock the field and prevent automatic updates, Ctrl+Shift+F11 to unlock the field.
    created 12 years ago (modified 12 years ago)

    Hi,
    I believe that we have already answered this question in the context of the Protect fields not to be editable ticket. For this reason, it makes sense to close this ticket as its duplicate. Should you need any further clarification, feel free to ask. I will be glad to help you.
    Thanks,
    Alessandro.

      Comments (2)
      BC BC
      Blake Christensen 12 years ago

        I'm sorry, but that thread does not address my issue.
        I understand protecting part of a document to prevent it from being edited by the user. I'm talking about applying the 'lock' attribute to a field to prevent the field from updating. The specific rtf code is \fldlock.
        I don't need to protect the field. I need to lock it.

        DevExpress Support Team 12 years ago

          Hi Blake,
          At present the RichEditControl doesn't support locking fields behavior but I agree with you that this feature can be really useful.
          I will pass this ticket to our developers so that they can consider the capability to implement this feature in future versions of the XtraRichEdit component.
          Do not hesitate to contact us if you have additional questions or need further assistance.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.