more RVAction Hyperlink questions
more RVAction Hyperlink questions
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
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
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Thanks.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.
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
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
for OnItemHint:
Code: Select all
srv.RichViewEdit.Options := srv.RichViewEdit.Options + [rvoShowItemHints];
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
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
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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
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
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.