more RVAction Hyperlink questions

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

more RVAction Hyperlink questions

Post by toolwiz »

There's an RVAction named rvActionInsertHyperlink1 that opens a dialog box when it's triggered (toolbar button and Insert | Hyperlink menu item). Where is that dialog box found?

There's a method RichViewEdit1_Jump(Sender: TObject; id: Integer) that's invoked if you click on a piece of text with a hyperlink set behind it through the above dialog box. (it's attached to the OnJump event on SRichViewEdit1.)

I'd like to make two changes in its behavior within SRV:

1) the mouseover of these items displays something in the status bar or a little pop-up hint to show what hyperlink is embedded in them;

2) the user needs to hold the CTRL key down to trigger the Jump method.

that is, I want something approximates what happens in MS Word.

Thanks
-David
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This dialog is included in RichViewActions (HypRVFrm.pas). You can use your own dialog instead of it, use rvActionInsertHyperlink.OnHyperlinkForm event.

You can use OnItemHint event to display hints when mouse is above some item.
CTRL key is used by default.
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Sergey Tkachenko wrote:This dialog is included in RichViewActions (HypRVFrm.pas). You can use your own dialog instead of it, use rvActionInsertHyperlink.OnHyperlinkForm event.

You can use OnItemHint event to display hints when mouse is above some item.
CTRL key is used by default.
Thanks.

BTW, CTRL key is NOT used by default. When I create an embedded hyperlink that appears in SRV's RVE and left-click on it, it opens the browser to that link. No CTRL key needed. That's why I asked.

I suppose I can add a bit of code to the handler that opens the hyperlink to see if the CRTL key is down.

Do you know offhand what I need to call to check the current state of the CTRL key? (I always do it from inside of a keystroke handler, which passes them as params.)

Thx
-David
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

If is set a handler for OnItemHint in SRV, it never gets triggered.

-David
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

If is set a handler for OnItemHint in SRV, then Hyperlink does not work?
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Yes, the hyperlink works; that's the OnJump handler. The OnItemHint handler is never triggered. I'd like to display the URL behind the link in the status bar.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I confirm this problem. Will be fixed.
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

for OnItemHint:

Code: Select all

  srv.RichViewEdit.Options := srv.RichViewEdit.Options + [rvoShowItemHints];
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Ok, thanks

It appears that the Hyperlink code that adds them to the item tags also encodes them -- apparently replacing spaces and punctuation with %xx forms. Is it necessary to do this when the hyperlinks are stored as tags? That is, can they be encoded later? (Do they need to be encoded at all?)

Alternatively, is there a DecodeURL function somewhere so when they're shown as hints they can be read by humans?

Thanks
-David
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Hmm... Make sure that rvActionInsertHyperlink.SpaceFiller = ' '. In older version it was '%20' by default, but now it is changed.
rvActionInsertHyperlink does nothing with punctuation, but it removes #13 and #10 characters.
toolwiz
Posts: 150
Joined: Wed Nov 30, 2005 3:27 am

Post by toolwiz »

Actually, if it finds CRs or LFs, it just sets Text = ''. But that's not a problem.

The question is ... is there any particular need to have encoded URLs stored in the Tags? I tried saving plain URLs and they're not being pulled up properly. But I'm not sure if it's because of that or something else. It's not really obvious to me how to work with the rvActionInsertHyperlink class for dealing with arbitrary text selections. It's set up to handle actions. In my case, I just need to read and set hyperlinks attached to text and images when the user makes certain selections in a dialog box. It's kind of like the Hyperlink dialog box, but I can't just pop it up the way that the Hyperlink dialog box is. You're not adding a hyperlink; rather, you setting some properties, and if there's a hyperlink specified (or not) among those properties, then it needs to be set (or cleared).

-David
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can look in RichViewActions.pas, TrvActionInsertHyperlink.EncodeTarget.
You will see that
1) it deletes CR and LF characters from target;
2) if SpaceFiller property does not contain space character, it changes all spaces to SpaceFiller.

(1) is absolutely necessary, otherwise this link cannot be stored in RVF. In any case, the standard RichViewActions hyperlink dialog does not allow entering multiline targets.
(2) is not necessary any more (in very old versions, tag strings could not contain space characters). So SpaceFiller=' ', and no processing occurs.

That means, target entered in the hyperlink dialog is stored as it is, without any modification. If in your application it is not so, please give the step-by-step instructions how to reproduce the problem.
Post Reply