ReadOnly won't be set

  • D2009, WP6.29.1

    In the form constructor I set WPRichText1.ReadOnly to true but reading it immediately after the assignment, it's false.

    The Culprit seems to be this little chap:

    function TWPCustomRtfEdit.GetReadOnly: Boolean;
    begin
    Result := FReadonly and (Memo._NotingIsProtected = 0);
    end;

    where _NothingIsProtected is 1.

    Not sure if this is relevant, but the ProtectedProps is:

    [ppParProtected
    ,ppCheckAllText
    ,ppProtected
    ,ppAllowEditAtTextEnd
    ,ppProtectSelectedTextToo]

    I need this edit window to be readonly so users doesn't assume they got edit-access right until they try to save the document.

    Why is _NothingIsProtected not zero, and why is it overriding the readonly state? Shouldn't it be a component-global setting? A best approach to set the editor readonly, is greatly appreciated.

    Thanks in advance

  • (FIXED, I guess)

    When I decide to make editor readonly I run this command:

    if SetRO then
    WPRichText1.Memo.EnableProtection;

    which decrements the variable to zero, thus enabling the the ReadOnly := true assignment. ... but only when _NotingIsProtected counter reaches zero.