List of Hyperlink

General TRichView support forum. Please post your questions here
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

List of Hyperlink

Post by miwan »

First excuse my English.

I'm new in programming in Delphi.
I appreciate your component is one of the best. and so I need help from you for my problem:
My question is:
I have a RichViewEdit1 and RichView1 in RichviewEdit1 will have one with a lot of text links.
Is it possible to list all the hyperlinks that are in RichViewEdit1 in RichView1 in the same Form1?

I want to produce this example

Image
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

A list of hyperlinks example: http://www.trichview.com/forums/viewtopic.php?t=397
This example creates a popup form containing a list of all hyperlinks in TListView. The demo moves the caret to the hyperlink chosen in this list.

Ok, as I understand, you want to create a list of hyperlinks not in TListView, but in TRichView. How should this list look like? Should it use the same font as in the original document? How should images-hyperlinks be displayed? What must happen when the user click on a link?
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

thank you for quick response :D


Ok, as I understand, you want to create a list of hyperlinks not in TListView, but in TRichView.
---> Yes I want to create a list of hypertext in Richview not in TListView
How should this list look like?
--->table index
Should it use the same font as in the original document?
---> Yes
How should images-hyperlinks be displayed?
---> image with Link
What must happen when the user click on a link?
---> got to link in TrichViewEdit

merci encore pour votre compréhension
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I'll create an example tomorrow.
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

I do not know how to thank you :oops:
you been very nice

:idea:
PS: I want to imitate a help file
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

good evening
I decided to make an example of what I would do.

http://www.mediafire.com/?igpexabuub4xvxn

I'll show you in this example in my application contains many hyperlinks. I want to copy the styles Richview green that are richviewEdit
Thank you kindly help me
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry for the delay.
I modified your project to create a list of links in RichView1:
http://www.trichview.com/support/files/listoflinks.zip
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

Thank you it's perfect, beautiful...

But There's a few observations that I would change:
1 - I want to add the hypertext style with a green (not all hypertext) .
2 - When I close the application I get an error message "Invalid pointer operation. " Where error ?

In the end, I appreciate your effort.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. For text hyperlinks, their fonts (including text color) is used. For images, hyperlinks are blue and underlined because they were created using rvActionInsertHyperlink1. To make it green, assign clGreen to rvActionInsertHyperlink1.Color.

2. What version of TRichView do you use? This demo was created for the new version where tags are strings.
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

Thank you for responding quickly
Allow me a little about the delay because of a problem online
I was not much clarity:
Assuming I have a lot of text with hyperlinks:
- Hyperlinks to the green movement in the same page (internal link).
- And the links in blue hyperlinks to navigate in the Internet browser (external link).
So I want RichView that accepts only the links in green if possible.
We have made ​​some adjustments, but some problems (incompatibility of links, the appearance of blank lines.)

modified test ----> : http://www.mediafire.com/?qm9rqe7pymku6au

I hope you corrected
Allow me to take a lot of your time is precious.
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

my version is 12.0.4 demo. :oops:
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can download the updated demo version from http://www.trichview.com/download/

Or, if you want still using the old version, you can exclude rvoTagsArePChars from Options of RichView1 (that is used to display links).

As for link color. I though that you wanted using font of the original hyperlink. Do you want to recolor ALL links and ignore the font color in the document? Do you want to use other font properties (name, size, etc.) of the original links?
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

Hello Sergey

I want to include hyperlinks that are green color in RichView and exclude that are blue color
it is not necessary properties of fonts
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

To create a list of links of the color clGreen, use this code:

Code: Select all

procedure TFmain.EnumLinksProc(RVData: TCustomRVData; ItemNo: Integer;
  var UserData1: Integer; const UserData2: String;
  var ContinueEnum: Boolean);
var StyleNo: Integer;
begin
  StyleNo := RVData.GetItemStyle(ItemNo);
  if RVData.GetRVStyle.TextStyles[StyleNo].Jump and
     (RVData.GetRVStyle.TextStyles[StyleNo].Color = clGreen) then
    RichView1.AddNLTag(RVData.GetItemText(ItemNo), RVData.GetItemStyle(ItemNo),
      0, RVData.GetItemTag(ItemNo));
  ContinueEnum := True;
end;
(in your example, green links have not clGreen color but $0050B000, so you need to modify).

Now, we have the next problem: the code in RichView1Jump that selected the chosen hyperlink, no longer work. It assumes that RichView1 and RichViewEdit1 have the same links, so it can use the id parameter (index of link in RichView1) to find link in RichViewEdit1.
I can modify this sample to fix this problem, but I still do not understand: when clicking a link in RichView1, do you want to select it in RichViewEdit1 or open in a browser?
miwan
Posts: 26
Joined: Tue Nov 01, 2011 8:30 pm

Post by miwan »

Hello sergey

for the new procedure does it work when inserting hyperlinks Green
but when I click on an item, there is no match.
I think I work with CheckPoint?
if I wait your help.
Post Reply