> retrieved from the database and displayed on screen, I want the user
> to be able to click on the link and the associated file will open up
I wrote a goodie called "US RichTextEdit Extensions" which might help
you. Surprisingly enough the RTF control already supports Links and is
also able to automatically detect URLs and turn them into links. If the
link you want is not a URL you have to make them linkable on your own -
but thats not very hard.
presenter := RichTextPresenter
showOn: 'This is my E-Mail Address:
mailto:Udo.Sc...@homeaddress.de .
Just drop me a mail or visit me here:
http://readthesourceluke.blogspot.com/'
asRichText.
(presenter view)
autoUrlDetect: true;
link: true;
enableMailtoLinks.
presenter
when: #linkClicked:
send: #value:
to:
[:link |
MessageBox notify: link
caption: 'Link clicked']
So if you have a RichTextPresenter view you can use #autoUrlDetect: to
enable/disable the automatic linking of URLs. #link: is used to enable
linking in general. So even if #autoUrlDetect is true you won't see any
links until you set #link: to true.
The package also contains a method to make mailto: links linkable.
#enableMailtoLinks parses the text and for mailto: links and hides the
mailto: prefix so that only the email address remains. However the link
itself still contains the mailto: + email combinations. This is a good
example how to use non-visible pre- and postfixes for link.
This is i.e. useful if you want to present a "simple link" to the user
but need a more descriptive link for your program.
To capture clicked links you simply have to hook up the the
#linkClicked: event in your #createSchemanticWiring method. The event
parameter is the complete link - not only the user visible part. So in
the mailto: link above you will get a
"mailto:Udo.Sc...@homeaddress.de" although only
"Udo.Sc...@homeaddress.de" is visible to the user.
You can download the most recent version of me goodies here:
http://readthesourceluke.blogspot.com/
However please note that the packages are for DST6 - however I see no
reason why the RTF package should not work in DST 5.1 as well.
Hope this helps.
CU,
Udo
Thanks for the goodies package. I upgraded to DST6 and have the URL
autodetect working, and will work on making file pathnames linkable.
Ted
On May 22, 4:55 pm, Udo Schneider <Udo.Schnei...@homeaddress.de>
wrote:
> Ted,
>
> > retrieved from the database and displayed on screen, I want the user
> > to be able to click on the link and the associated file will open up
>
> I wrote a goodie called "US RichTextEdit Extensions" which might help
> you. Surprisingly enough the RTF control already supports Links and is
> also able to automatically detect URLs and turn them into links. If the
> link you want is not a URL you have to make them linkable on your own -
> but thats not very hard.
>
> presenter := RichTextPresenter
> showOn: 'This is my E-Mail Address:
> mailto:Udo.Schnei...@homeaddress.de .
> "mailto:Udo.Schnei...@homeaddress.de" although only
> "Udo.Schnei...@homeaddress.de" is visible to the user.
> Thanks for the goodies package. I upgraded to DST6 and have the URL
> autodetect working, and will work on making file pathnames linkable.
You might want to take a look at #enableMailtoLinks. It makes mailto:
links "linkable". You could use it as a basis for your own kind of links.
CU,
Udo