Board index » cppbuilder » Making URLs in a memo clickable?

Making URLs in a memo clickable?


2003-07-28 11:55:35 PM
cppbuilder106
How would I implement this? First idea I had would be to check the mouse
coordinates over the memo and somehow check what is written at that
location, but that seems more or less complicated. Any other ideas?
/Jonas
 
 

Re:Making URLs in a memo clickable?

"Jonas Andersson" < XXXX@XXXXX.COM >wrote in message
Quote
How would I implement this?
For a TMemo, you wouldn't. Such functionality exists in newer versions of
RichEdit controls. However, TRichEdit only uses RichEdit v1.0 which does
not support clickable URLs. Have a look at the following page for a
TRichEdit replacement which supports newer RichEdit versions including the
functionality you are asking for:
home.att.net/~robertdunn/Yacs.html
Gambit
 

Re:Making URLs in a memo clickable?

Thank you!
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Jonas Andersson" < XXXX@XXXXX.COM >wrote in message
news:3f25477b$ XXXX@XXXXX.COM ...
>How would I implement this?

For a TMemo, you wouldn't. Such functionality exists in newer versions of
RichEdit controls. However, TRichEdit only uses RichEdit v1.0 which does
not support clickable URLs. Have a look at the following page for a
TRichEdit replacement which supports newer RichEdit versions including the
functionality you are asking for:

home.att.net/~robertdunn/Yacs.html


Gambit


 

{smallsort}

Re:Making URLs in a memo clickable?

For TRichEdit:
// In .cpp (Unit)
__fastcall TFormular::TFormular(TComponent* Owner): TForm(Owner)
{
unsigned mask = SendMessage(RichEdit1->Handle, EM_GETEVENTMASK, 0, 0);
SendMessage(RichEdit1->Handle, EM_SETEVENTMASK, 0, mask | ENM_LINK);
SendMessage(RichEdit1->Handle, EM_AUTOURLDETECT,true, 0);
RichEdit1->Text = "The Bridges Publishing Web Site is located at
www.bridgespublishing.com. Check it out.";
}
void __fastcall TFormular::WndProc(Messages::TMessage &Message)
{
if (Message.Msg == WM_NOTIFY)
{
if (((LPNMHDR)Message.LParam)->code ==EN_LINK)
{
ENLINK* p = (ENLINK *)Message.LParam;
if (p->msg == WM_LBUTTONDOWN)
{
SendMessage(RichEdit1->Handle, EM_EXSETSEL, 0, (LPARAM)&(p->chrg));
ShellExecute(Handle, "open", RichEdit1->SelText.c_str(), 0, 0,
SW_SHOWNORMAL);
}
}
}
TForm::WndProc(Message);
}
// In .h (Header)
public: void __fastcall WndProc(Messages::TMessage &Message);