Page 1 of 1

Bookmark idea

Posted: Sat Jan 09, 2021 6:34 pm
by jgkoehn
Greetings,
Is it possible to have a viewable text alongside the bookmark? I see the dot what about a small text in the green or would this mess with the size of the document?

Re: Bookmark idea

Posted: Sun Jan 10, 2021 10:49 am
by Sergey Tkachenko
Currently, checkpoints do not affect to the document formatting, they are simply drawn on top of the document.
It's possible to modify drawing using TRVStyle.OnDrawCheckpoint event (see TRichView demo in Assorted\CursomDraw\CustomDraw\)

Theoretically, it's possible to draw a checkpoint name above the text for the text at the position of the caret. But I still think it would be better to show its name in a tooltip.

Use OnItemHint event:

Code: Select all

procedure TForm3.RichViewEdit1ItemHint(Sender: TCustomRichView;
  RVData: TCustomRVData; ItemNo: Integer; var HintText: TRVUnicodeString);
var
  CPData: TCheckpointData;
  CPTag: TRVTag;
  CPName, S: TRVUnicodeString;
  RE: Boolean;
begin
  CPData := RVData.GetItemCheckpoint(ItemNo);
  if CPData <> nil then
  begin
    RVData.GetCheckpointInfo(CPData, CPTag, CPName, RE);
    S := 'Bookmark: ' + CPName;
    if HintText = '' then
      HintText := S
    else
      HintText := HintText + #13#10 + S;
  end;
  if RVData.GetItem(ItemNo).GetBoolValueEx(rvbpJump, Sender.Style) then
  begin
    S := 'Link: ' + RVData.GetItemTag(ItemNo);
    if HintText = '' then
      HintText := S
    else
      HintText := HintText + #13#10 + S;
  end;
end;
This code shows checkpoint names and hyperlink targets in tooltips.

Include rvoShowItemHints in RichViewEdit.Options, and make sure that RichViewEdit.ShowHint = True.