How to detect is an embedded object is deleted

  • Hi!

    I need to check if my text contains any non-deleted embedded objects before saving. How can I do this?

    I have tried looping through TWPRichText.TextObjects and for each object I have the following function:

    function IsReferred: Boolean;
    var
    Tag: Integer;
    Item: PWPListItem;
    begin
    Tag := Self.WPRichText.Memo.TxtObjLst.FindTag(WPObj);
    Item := Self.WPRichText.Memo.TxtObjLst.Find(Tag);
    if (Item<nil>0) then
    Result := true
    else
    Result := false;
    end;

    Unfortunately this does not work for objects that have been copied from one place to another in the editor.

    Regards,
    Erik

    • Offizieller Beitrag

    Hi,

    You will need a loop "over all paragraphs, over all lines, over all characters" and check for the tag in the accompanied PTAttr^ structure. (See code below)

    This tag can be then used to locate the TWPTextObject record using FindTag.