Workspace URL-link hypertext

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Workspace URL-link hypertext

tgkuo
I've played in Squeak for a while and felt its capacity to make
URL-links typed in workspace be automatically displayed as Hypertext mark
( i.e. could be activated by mouse-clicking, as web browser does) is great.
    Could the same effects be programmtically integrated similarly into
Dolphin's
Workspace by users, as easily as Squeak afford ( by some function keys to
enable many link function choices  as Squeak does ) ?
    It would be more convenient if it is possible, --> imagine that the
workspace
becomes more powerful and dynamic, not just passively display the static
(rich)
text!  :-)


Thanks.


Tsun-kuo Kuo


Reply | Threaded
Open this post in threaded view
|

Re: Workspace URL-link hypertext

Ian Bartholomew-18
kuo wrote:
>      I've played in Squeak for a while and felt its capacity to make
> URL-links typed in workspace be automatically displayed as Hypertext
> mark ( i.e. could be activated by mouse-clicking, as web browser
>     does) is great. Could the same effects be programmtically
> integrated similarly into Dolphin's
> Workspace by users, as easily as Squeak afford ( by some function
> keys to enable many link function choices  as Squeak does ) ?

I'm not quite sure what you mean by the second bit but you can enable URL
detection quite easily if you are using Windows2000 or Windows XP. This
restriction is because Dolphin uses version 1 of the RichEdit control but
the following behaviour was only introduced in RichEdit 2.  Windows 2000 and
XP just emulate RichEdit1 and therefore use a newer dll that also provide
this functionality, earlier OSs still include the RichEdit1 dll which
doesn't.

You might want to try this whatever OS you are using though - some strange
things happen in RichEditLand :-)

The following opens up a SmalltalkWorkspaceDocument and enables auto URL
detection

v := SmalltalkWorkspaceDocument show.
(v view viewNamed: 'workspace') referee
    sendMessage: 1115 "AUTOURLDETECT"
    wParam: true asParameter
    lParam: 0

Now, when you type a valid URL it is underlined in the normal manner.  You
can check if URL detection is on or off with

(v view viewNamed: 'workspace') referee
    sendMessage: 1116 "GETAUTOURLDETECT"
    wParam: 0
    lParam: 0

It's a bit more difficult to demonstrate what happens when the user clicks
on the displayed link so suffice it to say that the view receives an EN_LINK
notification.

You can also manually get the text selection to display as a link by setting
the CFE_LINK style (as in setting bold and italic).

Let me know if you want further details on any of the above.

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Workspace URL-link hypertext

tgkuo
Hi Ian,
    Thanks for your guidance. It worked in my D5 + Windows
XP environement.
     I want to further explore the EN_LINK message,  trying to work out that
if I could catch the event through View>>initializeMessageMap to
another message handler,  just like the messageMap: "at:
WM_LBUTTONDBLCLK + 1 put: #wmLButtonDblClk:wParam:lParam:; =>
onLeftButtonDoubleClicked: aMouseEvent" does, so that I could get the URL
string that was clicked and showup a URLPresenter with that value.
    Is my reasoning corrent? and how? ( I sofar could not figure out the
way,
since I'm a relatively newbie in Dolphin).

Thanks.
Tsun-kuo Kuo.

"Ian Bartholomew" wrote:

> >      I've played in Squeak for a while and felt its capacity to make
> > URL-links typed in workspace be automatically displayed as Hypertext
> > mark ( i.e. could be activated by mouse-clicking, as web browser
> >     does) is great. Could the same effects be programmtically
> > integrated similarly into Dolphin's
> > Workspace by users, as easily as Squeak afford ( by some function
> > keys to enable many link function choices  as Squeak does ) ?
>
> I'm not quite sure what you mean by the second bit but you can enable URL
> detection quite easily if you are using Windows2000 or Windows XP. This
> restriction is because Dolphin uses version 1 of the RichEdit control but
> the following behaviour was only introduced in RichEdit 2.  Windows 2000
and

> XP just emulate RichEdit1 and therefore use a newer dll that also provide
> this functionality, earlier OSs still include the RichEdit1 dll which
> doesn't.
>
> You might want to try this whatever OS you are using though - some strange
> things happen in RichEditLand :-)
>
> The following opens up a SmalltalkWorkspaceDocument and enables auto URL
> detection
>
> v := SmalltalkWorkspaceDocument show.
> (v view viewNamed: 'workspace') referee
>     sendMessage: 1115 "AUTOURLDETECT"
>     wParam: true asParameter
>     lParam: 0
>
> Now, when you type a valid URL it is underlined in the normal manner.  You
> can check if URL detection is on or off with
>
> (v view viewNamed: 'workspace') referee
>     sendMessage: 1116 "GETAUTOURLDETECT"
>     wParam: 0
>     lParam: 0
>
> It's a bit more difficult to demonstrate what happens when the user clicks
> on the displayed link so suffice it to say that the view receives an
EN_LINK
> notification.
>
> You can also manually get the text selection to display as a link by
setting

> the CFE_LINK style (as in setting bold and italic).
>
> Let me know if you want further details on any of the above.
>
> --
> Ian
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Workspace URL-link hypertext

Ian Bartholomew-18
kuo wrote:

>      I want to further explore the EN_LINK message,  trying to work
> out that if I could catch the event through
> View>>initializeMessageMap to
> another message handler,  just like the messageMap: "at:
> WM_LBUTTONDBLCLK + 1 put: #wmLButtonDblClk:wParam:lParam:; =>
> onLeftButtonDoubleClicked: aMouseEvent" does, so that I could get the
> URL string that was clicked and showup a URLPresenter with that value.
>     Is my reasoning corrent? and how? ( I sofar could not figure out
> the way,
> since I'm a relatively newbie in Dolphin).

It actually arrives as a notification so it's probably easier to modify
#nmNotify: in RichTextEdit so that it responds to EN_LINK.

I'll put together a package that extends RichTextEdit (so that it
automatically detects URLs and triggers an event off the presenter when one
is clicked).  It involves a little work (defining a couple of new structure
classes) so it might be a couple of hours....

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Workspace URL-link hypertext

Ian Bartholomew-18
Ian Bartholomew wrote:
>             so it might be a couple of hours....

or maybe less.

I've uploaded a 3.3K package to

http://idb.me.uk/linktestdemo.zip

This adds URL links to the existing RichTextEdit class and provides a shell
to test that it works.  Install the package, ignoring the warning about
overwriting methods, and evaluate

LinkTest show

Type a url into the edit field and click on it. The LinkTest status bar
should display the text of the link you selected.  You can then extend this
to open up your web browser on the link, start your FTP client or whatever.

NB
    - Don't save the image when you exit.
    - If I was permanently adding this feature to the image I probably
wouldn't do it this way (with regards to the notification message anyway).

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Workspace URL-link hypertext

tgkuo
Ian, thank a lot, the request was fulfilled perfectly.
Excellent work indeed.


Best regards
Tsun-kuo Kuo.