JVCL Help:TJvTextAttributes.Link

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Indicates whether the text represented by the TJvTextAttributes object is a link.


Pascal

 propertyLink: Boolean;


Description

Text that represents a link is underlined and colored blue. If the user clicks on the link text an OnURLClick event is fired.
If you want to set the Link property for specific text, then AutoURLDetect must be set to false. When AutoURLDetect is set to true, the rich edit control applies and removes the link property to specific text automatically.
Note that the link is not persistent, ie. if you save the text to a (RTF) file the links will not be saved.
You could also insert a link by inserting RTF codes. Such a link will also not be saved for rich edit dll version 3.0 and below, but it will be saved for rich edit dll version 4.0 and up.
const

 cHyperlink = '{rtf1{field {*fldinst {HYPERLINK "%s" }}{fldrslt {ul %s }}}}';
var
S: string;
Stream: TStream;
begin
S := Format(cHyperLink, ['http://jvcl.sourceforge.net', 'JVCL']);


 Stream := TMemoryStream.Create;
try
Stream.Write(PChar(S)^, Length(S));
Stream.Position := 0;


   JvRichEdit1.StreamFormat := sfRichText;
JvRichEdit1.StreamMode := [smSelection, smPlainRtf];
JvRichEdit1.Lines.LoadFromStream(Stream);
{ Don't forget to clear the smSelection flag: normally we want to save the whole text, and such a flag is easily forgotten }
JvRichEdit1.StreamMode := [];
finally
Stream.Free;
end;
end;


See Also

TJvCustomRichEdit.OnURLClick, TJvTextAttributes.Disabled, TJvTextAttributes.Hidden, TJvTextAttributes.Protected, TJvTextAttributes.Style


About

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page