Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

embedding link to file in textbox contents

6 views
Skip to first unread message

ts...@comcast.net

unread,
May 22, 2008, 10:12:52 AM5/22/08
to ts...@comcast.net
I am creating an application where the user can enter some text into a
multi-line textbox. As the user is typing text into the textbox, I
want the user to be able to insert links to files on the company
network. The contents of the textbox (including the file links) will
be stored in an underlying database. In a subsequent session of the
application, when the text (including embedded file links) is
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
in a new window. Typically the file will be Word, Excel, or .PDF,
although it would be nice to not have stringent limitations on the
file type. Can I do this in Dolphin 5.1? Thanks. -Ted

Udo Schneider

unread,
May 22, 2008, 4:55:52 PM5/22/08
to
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.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

ts...@comcast.net

unread,
May 23, 2008, 9:03:02 AM5/23/08
to
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.

Udo Schneider

unread,
May 23, 2008, 1:14:55 PM5/23/08
to
Ted,

> 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

0 new messages