Hello. I am currently converting an app using WPTools v3 to v6 and the conversion is going nicely.
We previously used visible bookmarks to mark places in the document editor. The user could hotkey from bookmark to bookmark, entering text next to the bookmark. Bookmarks typically remained in the document but only visible while editing.The new text typed adjacent the the bookmarks would be normal text leaving the bookmark as it was.
The bookmarks could be deleted (with backspace), But only inserted via menu command.
The bookmarks contain one visible character ‘^’ and are surrounded with the usual bkmkstart\bkmkend tags in the file.
However, in the new WPTools v6 We’re having difficulty keeping new text from writing inside the start\end tags. The contents of the bookmarks ‘^’ expand with the new text.
We want the Bookmarks ‘^’ to be deleted like any other character. But don’t want thee bookmark text expanded when new normal text is typed adjacent to them.
Our previous methods worked well in this regard but the changes have made it difficult to refactor.
Can you provide any guidance?
Here is how we achieved this behavior in WPTools 3.
procedure TRTFEditor.OnKeyPressEvent(Sender: TObject; var Key: char);
begin
if afsBookmark in CurrAttr.Style then // prevent bookmark attribute from continuing beyond bookmark
begin
BeginUpdate;
CurrAttr.DeleteStyle([afsBookmark]);
EndUpdate;
end;
end;
Regards,