hi (sorry for my bad english)
how can i make an hypertext ? so i want add a URL to a RV and the URL should blue and underline and if i click it, the IE opend with the URL ?
to recognize the URL i have it already but how can i it click-able ?
greez & thx, sky...
HyperText
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
For URL insertion, see the demo http://www.trichview.com/forums/viewtopic.php?t=61
For URL detection on typing, see the demo Demos\Delphi\Assorted\Hypertext\URLs
(there is an advanced version of this demo - http://www.trichview.com/support/files/urls.zip , but itrequires TRichView v1.9.31 or newer)
Note that by default hypertext in editor works when user presses and holds Ctrl key. The last demo ( http://www.trichview.com/support/files/urls.zip ) shows how to implement hypertext on single click. But I personally think it's very inconvenient.
For URL detection on typing, see the demo Demos\Delphi\Assorted\Hypertext\URLs
(there is an advanced version of this demo - http://www.trichview.com/support/files/urls.zip , but itrequires TRichView v1.9.31 or newer)
Note that by default hypertext in editor works when user presses and holds Ctrl key. The last demo ( http://www.trichview.com/support/files/urls.zip ) shows how to implement hypertext on single click. But I personally think it's very inconvenient.
hi..
in my oppinion , the hole richview is always scanned in URL´s. but i only want to add one line, which is right from the beginning (and not always the hole richview scann again.) the addition of items/hyperlink i still do not really understand. perhaps you can explain it to me!?
greez & thx, sky...
in my oppinion , the hole richview is always scanned in URL´s. but i only want to add one line, which is right from the beginning (and not always the hole richview scann again.) the addition of items/hyperlink i still do not really understand. perhaps you can explain it to me!?
greez & thx, sky...
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Do you want to insert hyperlink in the position of caret (as an editing operation)? Or do you want to generate document with hyperlinks?
The demo http://www.trichview.com/forums/viewtopic.php?t=61 allows making hyperlink from the selected text. Inserting new hyperlink is even simpler:
---
Update 2011-Oct-22: starting from TRichView 13.3, use Target instead of Integer(StrNew(PChar(Target)))
The demo http://www.trichview.com/forums/viewtopic.php?t=61 allows making hyperlink from the selected text. Inserting new hyperlink is even simpler:
Code: Select all
var StyleNo: Integer;
Text, Target: String;
Text := 'Click Here';
Target := 'http://www.trichview.com';
StyleNo := RichViewEdit1.CurTextStyleNo;
// GetHypertextStyleNo is from the demo
RichViewEdit1.CurTextStyleNo := GetHypertextStyleNo(StyleNo);
RichViewEdit1.InsertStringTag(Text, Integer(StrNew(PChar(Target))));
RichViewEdit1.CurTextStyleNo := StyleNo;
Update 2011-Oct-22: starting from TRichView 13.3, use Target instead of Integer(StrNew(PChar(Target)))
Last edited by Sergey Tkachenko on Sat Oct 22, 2011 7:04 pm, edited 1 time in total.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Some basics.
In TRichView, documents consists of items. One item can be:
- picture, or control, or horizontal line, or other object;
- text without line break characters and without tabs, formatted with one text style;
- table (the most complex case, because table contains subdocuments (cells) consisting of their own items).
Items have different properties, for example tags (integer or string value for your own use). Tags can be used to store hypertext targets.
Any text item formatted with text style having Jump property = True is a hyperlink.
Additional information in the help file.
In TRichView, documents consists of items. One item can be:
- picture, or control, or horizontal line, or other object;
- text without line break characters and without tabs, formatted with one text style;
- table (the most complex case, because table contains subdocuments (cells) consisting of their own items).
Items have different properties, for example tags (integer or string value for your own use). Tags can be used to store hypertext targets.
Any text item formatted with text style having Jump property = True is a hyperlink.
Additional information in the help file.