Notification when user deletes bookmark

  • If the user selects and deletes text that contains one or more bookmarks, how can I be notified of this event? I need to know the names of any bookmarks that were deleted using the delete or backspace keys, as well as those being cut to the clipboard.

  • Please paste some code to determine the list of bookmarks that are contained in the currently selected text. Assume that the document could contain any number of bookmarks and that the user may have selected text which contains only a few of them.

    • Offizieller Beitrag

    You need an eventhandler of this type:

    procedure Form1.TextObjCallback(Sender: TObject;
    TxtObj: TWPTextObj;
    par: TParagraph;
    posinpar: Integer;
    var Abort: Boolean) of object;


    Using TextObj You can check for bookmark objects.

    Now You can call

    WPRichText1.HeaderFooter.CallForSelectedText(
    Self, [], nil, nil, nil, TextObjCallback);

    to make TextObjCallback be called for all objects in the selection.

    Julian