Bookmark idea

General TRichView support forum. Please post your questions here
Post Reply
jgkoehn
Posts: 303
Joined: Thu Feb 20, 2020 9:32 pm

Bookmark idea

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Bookmark idea

Post 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.
Post Reply