Request for new event- BeforeLeaveRTFDataBlock

  • Can we have a new BeforeLeaveRTFDataBlock event in TWPCustomRtfEdit. This would be implemented as follows:

    This will allow us to lock users into data blocks under program control. In particular, our application will have two distinct edit modes - Body Mode and Header/Footer Mode. Currently we can lock the user into the body using the wpDisableEditOfNonBodyDataBlocks option, but there is no way of locking them out of the body when they are in our Header/Footer Mode. Introducing our proposed event will be much more flexible than creating another EditOptionsEx value such as wpDisableEditOfBodyDataBlocks

  • Actually my implementation is no good as I need to know the destination data block. So please consider the following solution which works for me - Modify WPRTEPaint as follows (new or modified lines marked with {*}):

    1) add new data type for the event

    Code
    ...type  TWPRTFEnginePaint = class;  TWPLeaveRTFDataBlockEvent = procedure(Sender: TWPRTFEnginePaint;    FromBlock, ToBlock: TWPRTFDataBlock; var Allowed: Boolean) of object; {*}


    2) Create the event property

    Code
    TWPRTFEnginePaint = class(TWPRTFEngineBasis)...    FOverridePageCount, FOverridePageOffset: Integer;    FBeforeLeaveRTFDataBlock: TWPLeaveRTFDataBlockEvent; {*}    procedure SetUseANSITextAttr(x: Boolean);...    property OnGetPageGapText: TWPOnGetPageGapText read _OnGetPageGapText write _OnGetPageGapText;    property BeforeLeaveRTFDataBlock: TWPLeaveRTFDataBlockEvent read FBeforeLeaveRTFDataBlock write FBeforeLeaveRTFDataBlock; {*}  end;


    3) Now implement in MoveCursor function


    I hope you will be able to include these changes in your next release.