OnJump -> OnRVDblClick

General TRichView support forum. Please post your questions here
Post Reply
Fab85
Posts: 31
Joined: Tue Apr 09, 2024 6:02 am

OnJump -> OnRVDblClick

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

Re: OnJump -> OnRVDblClick

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