Insert text in Protected text area is possible

  • The following code describes my problem:

    Code
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      WPRichText1.ProtectedProp := [];
      WPRichText1.CurrAttr.AddStyle([afsProtected]);
      WPRichText1.InputString(#13);
      WPRichText1.InputString('Test');
      WPRichText1.InputString(#13);
      WPRichText1.CurrAttr.DeleteStyle([afsProtected]);
      WPRichText1.ProtectedProp := [ppParProtected,ppProtected];
    end;

    It is possible to insert text before 'Test', and the text inserted gets protected so it can't be removed again. Isn't this somehow a bug.
    Isn't it possible to make the CR protected too?

    • Offizieller Beitrag

    Hi,

    by priciple a CR is not protected. It is planned to have protected text start/end markers in a later version but for now it is just using the protected attribute known from version 4. (Didn't want to cause confusion)

    Note this flags, they can help

    ppNoEditAfterProtection,
    ppInsertBetweenProtectedPar

    But an empyt par can be only proteced by protecting the paragraph itself, using par.ASet(WPAT_ParProtected, 1)

    Julian