Page 1 of 1

OnJump -> OnRVDblClick

Posted: Thu Apr 10, 2025 12:45 pm
by Fab85
Hello,

Open link using Onjump event work fine.
But on my old application with TrichEdit I handle OnDblClick event to open link (so without CTRL pressed). So I need to do the same with TrichViewEdit.


So I try to do the same with :

Code: Select all

procedure MyTRichView.OnTRichViewEditRVDblClick(Sender: TCustomRichView;  ClickedWord: TRVUnicodeString; Style: Integer);
var
  LRVData:        TCustomRVFormattedData;
  LItemNo, LOffs: Integer;
  LLink:            String;
  pt:             TPoint;
begin
  if not assigned(Sender) then
     exit;

   LGlobalMousePos := Mouse.CursorPos;
   LLocalMousePos := (Sender as TControl).ScreenToClient(LGlobalMousePos);

   pt := Sender.ClientToDocument(Point(LLocalMousePos.X, LLocalMousePos.Y));

  if Sender.GetItemAt(pt.X, pt.Y, LRVData, LItemNo, LOffs, True) and
    LRVData.GetItem(LItemNo).GetBoolValueEx(rvbpJump, Sender.Style) then // Doesn't work for hyperlink/jump
  begin
    LLLink := LRVData.GetItemTag(LItemNo);
    OpenUrl(LLLink);
  end;

end;

But if the end-user click on a hyperlink (= which call the onjump event is CTRL is down) the condition :

Code: Select all

  if Sender.GetItemAt(pt.X, pt.Y, LRVData, LItemNo, LOffs, True) and
    LRVData.GetItem(LItemNo).GetBoolValueEx(rvbpJump, Sender.Style) then
Always return false

So how to detect the url clicked in a OnRVDblClick event ?

Re: OnJump -> OnRVDblClick

Posted: Mon Apr 14, 2025 5:31 pm
by Sergey Tkachenko
Sorry, but I cannot reproduce this problem.
I copied your code in the ActionTestTabs demo, and this code works, both for links in the root document and for links in table cells.

Can you give me step-by-step instructions how to reproduce the problem?