Ticket Q351457
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

RichEditControl - Support locked fields

Protect fields not to be editable

created 13 years ago

Hi,
In our project I need to protect all Fields in the document so the user cannot edit/delete them.
I decided to use the solution described in http://www.devexpress.com/Support/Center/p/E3017.aspx, that is protecting via RangePermissions.
The problem is that it seems that this mechanism is not Protection, it is Unprotection. I mean that if you want user to be able edit whole document except Fields, you need to add "SomeUser" permissions to Fields, and add "Everyone" permissions to the segments between fields (which is too difficult to calculate taking into consideration the fact that Fields are often added and removed programmatically during the user work).
Do I miss anything? Isn't there an easier way to achieve my goal?
For example it would be perfect to add some RangePermissions to ONLY Fields, and the rest of the document remains editable.
And I also have one more question which is actually less important. Is there any event in DX richedit that fires when the user tries to edit protected content? I'd like to show some message box for such cases.
Thanks in advance,
Vahe

Answers approved by DevExpress Support

created 13 years ago (modified 11 years ago)

Hello Vahe,
Thank you for your message. I believe that you can utilize the approach from the How can i prevent the user from deleting DOCVARIABLES thread, in which a similar issue has been discussed. As for your additional question, you can handle the RichEditControl.SelectionChanged Event in the manner shown in the attached sample to accomplish a similar task.
PS: I should mention that our team is dedicated to addressing all your concerns. However, for quick and efficient responses we kindly request you to cover one issue at a time in future messages. We would greatly appreciate your time and cooperation.
Thanks,
Alessandro.

    Comments (2)

      Hi Alessandro,
      Thank you very much for your response.
      I'll make sure not to ask more than one questions in one thread.
      Unfortunately regarding the first question I still did not get the answer. I'm sorry but it seems that you have not read carefully my post. As you can see in my question I had already examined the example from http://www.devexpress.com/Support/Center/p/E3017.aspx, which is much more informative than the example sent by you. However both examples cannot cover my problem (in fact they give me only workarounds).
      As I have already said in that example it is shown a way how to UNPROTECT a DocumentRange so that a user CAN edit it. I want a way to PROTECT a DocumentRange, so that the user CANNOT edit it.
      """"I mean that if you want protect some ranges from editing, you need to add "SomeUser" permissions to those ranges, and add "Everyone" permissions to the segments between fields (which is too difficult to calculate taking into consideration the fact that these ranges are often added and removed programmatically during the user work).""""
      Sorry for bothering you once more and thanks in advance,
      Vahe

      Alessandro (DevExpress Support) 13 years ago

        Hello Vahe,
        Thank you for your clarification.
        <<<
        As I have already said in that example it is shown a way how to UNPROTECT a DocumentRange so that a user CAN edit it.
        >>>
        You are absolutely correct. The XtraRichEdit document protection concept is based on the list of users and ranges that these users can edit. I am afraid that there is no appropriate method to change this concept. You need to utilize the existing document protection API to accomplish this task. As an alternative solution, consider utilizing the approach from the How to handle key press events via services example. Please feel free to ask for clarification if necessary. We will be glad to help you.
        Thanks,
        Alessandro.

        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.