Solved

Detecting URLs in TMemo

Posted on 1998-08-30
8
342 Views
Last Modified: 2012-05-04
I am using a TMemo in a mail client. I would like to implement the function of having URLs in the TMemo become links that can be clicked to launch web browser.
0
Comment
Question by:sharons
8 Comments
 
LVL 7

Expert Comment

by:BlackMan
ID: 1338174
If you want to use TMemo, I think you have some hard work to do. Instead you can switch to RichEdit v2, it has a AutoURLDetect property. There is an example on www.torry.com on how to use it.

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1338175
What identifies a URL? Just the "http://"?
0
 

Author Comment

by:sharons
ID: 1338176
Thank you. I tried to find that example in Torry's but could not find it. Is it in Examples or is it with a component ?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 7

Expert Comment

by:BlackMan
ID: 1338177
You can find the example under "Components / Edit,Memos #2" with the name TRichEdit98.
Direct download is www.torry.com/vcl/edits/richedit98.zip

0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1338178
who is sharons?
(your profile doesn't tell too much)
BlackMan's comment's it.

cheers,
Black Death.
0
 
LVL 4

Expert Comment

by:binkzz
ID: 1338179
You can of course do it the 'hard' way, which would be :

procedure findurl(sender: Tobject);
const url = 'http://';
var urlpos : array[1..100,1..100] of boolean;
for i := 1 to memo.lines do
begin
  for j := 1 to length(memo.lines[i]) - 6 do
  begin
    if copy(memo.lines[i],j,length(url)) = url then urlpos[j, i] := true;
    memo2.lines.add('url found on line ' + inttostr(i) + ' at position + ' inttostr(j));
  end;
end;

You can cut pieces out of there to make it a one line function, which might be easier to find.
0
 

Author Comment

by:sharons
ID: 1338180
Thank you all. I used Blackmans suggestion to use TRichEditV2 from Torry and it works great. One thing I did not include in the description of the problems is that I also want to be able to click on these links and invoke the Web Browser. TRichEditV2 does just that.  So I guess the points should go to BlackMan.
0
 
LVL 7

Accepted Solution

by:
BlackMan earned 70 total points
ID: 1338181
If you want to use TMemo, I think you have some hard work to do. Instead you can switch to RichEdit v2, it has a AutoURLDetect property. There is an example on www.torry.com on how to use it.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 132
Using idhttp to login to instagram 2 90
how to send memory stream from ics Client To ics server ? 11 112
Performance of SQL statement 37 112
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question