TextAttribute, TextAction and TextDoIt or TextURL: not working

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

TextAttribute, TextAction and TextDoIt or TextURL: not working

philippeback
I've been investigating with text.

I found things that do work like:

((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: EllipseMorph new)) , (Text withAll: 'bar')) asMorph openInWorld.

((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: ThemeIcons confirmIcon)) , (Text withAll: 'bar')) asMorph openInWorld.

But doing: 

((Text withAll: 'foo') , (Text string: 'some link' attribute: (TextURL new url:'http://philippeback.eu')) , (Text withAll: 'bar')) asMorph openInWorld.

gives me a nice purple 'some link' bit but clicking on it fails with

MessageNotUnderstood: TextURL>>actOnClick:for:in:editor:

Damn! Ideas on how to tackle this?

TIA
Philippe Back

PharoScreenshot.2.png (311K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

Eliot Miranda-2


On Mon, Apr 9, 2012 at 2:56 PM, [hidden email] <[hidden email]> wrote:
I've been investigating with text.

I found things that do work like:

((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: EllipseMorph new)) , (Text withAll: 'bar')) asMorph openInWorld.

((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: ThemeIcons confirmIcon)) , (Text withAll: 'bar')) asMorph openInWorld.

But doing: 

((Text withAll: 'foo') , (Text string: 'some link' attribute: (TextURL new url:'http://philippeback.eu')) , (Text withAll: 'bar')) asMorph openInWorld.

gives me a nice purple 'some link' bit but clicking on it fails with

MessageNotUnderstood: TextURL>>actOnClick:for:in:editor:

Damn! Ideas on how to tackle this?


Take a look at the Squeak code?  There I see TextURL implements actOnClickFor: not the 4 arg method.  So perhaps the dispatcher has been changed to no longer support the one-argument form.  you could either change the one-arg method into the longer form or fix the dispatcher.
 

TIA
Philippe Back



--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

Camillo Bruni-3
I introduced a new 4 arg protocol for the semantic source links.
the old single arg protocol is not that useful since it doesn't allow for dispatching back over the editor...

For a proper implementation of the new protocol check one of the TextLink subclasses, for instance: TextClassLink>>#actOnClick:for:in:editor:

On OSX/Linux I would simply use OSProcess to open a URL in the system's default browser

On 2012-04-10, at 00:55, Eliot Miranda wrote:

>
>
> On Mon, Apr 9, 2012 at 2:56 PM, [hidden email] <[hidden email]> wrote:
> I've been investigating with text.
>
> I found things that do work like:
>
> ((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: EllipseMorph new)) , (Text withAll: 'bar')) asMorph openInWorld.
>
> ((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: ThemeIcons confirmIcon)) , (Text withAll: 'bar')) asMorph openInWorld.
>
> But doing:
>
> ((Text withAll: 'foo') , (Text string: 'some link' attribute: (TextURL new url:'http://philippeback.eu')) , (Text withAll: 'bar')) asMorph openInWorld.
>
> gives me a nice purple 'some link' bit but clicking on it fails with
>
> MessageNotUnderstood: TextURL>>actOnClick:for:in:editor:
>
> Damn! Ideas on how to tackle this?
>
>
> Take a look at the Squeak code?  There I see TextURL implements actOnClickFor: not the 4 arg method.  So perhaps the dispatcher has been changed to no longer support the one-argument form.  you could either change the one-arg method into the longer form or fix the dispatcher.
>  
>
> TIA
> Philippe Back
>
>
>
> --
> best,
> Eliot
>


Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

philippeback

Ok. The point is to create buttons or shapes or figures in the text for a game I am making. I want it to run on the iOS vm. So the has nothing to do with osprocess. Just a sample action for text.

Le 10 avr. 2012 15:09, "Camillo Bruni" <[hidden email]> a écrit :
I introduced a new 4 arg protocol for the semantic source links.
the old single arg protocol is not that useful since it doesn't allow for dispatching back over the editor...

For a proper implementation of the new protocol check one of the TextLink subclasses, for instance: TextClassLink>>#actOnClick:for:in:editor:

On OSX/Linux I would simply use OSProcess to open a URL in the system's default browser

On 2012-04-10, at 00:55, Eliot Miranda wrote:
>
>
> On Mon, Apr 9, 2012 at 2:56 PM, [hidden email] <[hidden email]> wrote:
> I've been investigating with text.
>
> I found things that do work like:
>
> ((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: EllipseMorph new)) , (Text withAll: 'bar')) asMorph openInWorld.
>
> ((Text withAll: 'foo') , (Text string: '*' attribute: (TextAnchor new anchoredMorph: ThemeIcons confirmIcon)) , (Text withAll: 'bar')) asMorph openInWorld.
>
> But doing:
>
> ((Text withAll: 'foo') , (Text string: 'some link' attribute: (TextURL new url:'http://philippeback.eu')) , (Text withAll: 'bar')) asMorph openInWorld.
>
> gives me a nice purple 'some link' bit but clicking on it fails with
>
> MessageNotUnderstood: TextURL>>actOnClick:for:in:editor:
>
> Damn! Ideas on how to tackle this?
>
>
> Take a look at the Squeak code?  There I see TextURL implements actOnClickFor: not the 4 arg method.  So perhaps the dispatcher has been changed to no longer support the one-argument form.  you could either change the one-arg method into the longer form or fix the dispatcher.
>
>
> TIA
> Philippe Back
>
>
>
> --
> best,
> Eliot
>


Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

Sean P. DeNigris
Administrator
In reply to this post by philippeback
philippeback wrote
doing:

((Text withAll: 'foo') , (Text string: 'some link' attribute: (TextURL new
url:'http://philippeback.eu')) , (Text withAll: 'bar')) asMorph openInWorld.

gives me a nice purple 'some link' bit but clicking on it fails with

MessageNotUnderstood: TextURL>>actOnClick:for:in:editor:
Issue 12075: Fix TextActions and Add SourceWebBrowser for TextUrl

Fix in inbox: TextDoIt, TextPrintIt, PluggableTextAttribute, and TextURL now work. This fix also adds a SourceWebBrowser, which simply opens the page source in a Workspace, and registers it under "tools webBrowser". The idea is that e.g. ExternalWebBrowser or another external project could override this very basic functionality.

I'm also attaching the .cs to Nabble TextActions.cs in case you want it in pre-3.0 (tested in 2.0).

To test:

ws := Workspace openContents: 'Transcript open'.
wsWindow := World submorphs detect: [ :e | e model == ws ].
wsTextMorph := wsWindow findDeeplyA: TextMorph.
text := wsTextMorph text.
attr := TextDoIt evalString: text.
text addAttribute: attr.
 
ws := Workspace openContents: '1 + 1'.
wsWindow := World submorphs detect: [ :e | e model == ws ].
wsTextMorph := wsWindow findDeeplyA: TextMorph.
text := wsTextMorph text.
attr := PluggableTextAttribute evalBlock: [ :e | e contents: '' ].
text addAttribute: attr.
 
ws := Workspace openContents: '1 + 1'.
wsWindow := World submorphs detect: [ :e | e model == ws ].
wsTextMorph := wsWindow findDeeplyA: TextMorph.
text := wsTextMorph text.
attr := TextPrintIt evalString: text.
text addAttribute: attr.
 
ws := Workspace openContents: '1 + 1'.
wsWindow := World submorphs detect: [ :e | e model == ws ].
wsTextMorph := wsWindow findDeeplyA: TextMorph.
text := wsTextMorph text.
attr := TextURL new url: 'http://www.google.com';.
text addAttribute: attr.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

philippeback
,Ooooohhh!!!!

I guess I'll restart work on that old 1.3-based project of mine :-)

Well, well,this opens a lot of doors! (including doc comments with links inside them for clickable cross refs, like we had in squeak)

Now, it is going to be used with Tx stuff ?

Phil
Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

Igor Stasenko



On 5 November 2013 22:56, [hidden email] <[hidden email]> wrote:
,Ooooohhh!!!!

I guess I'll restart work on that old 1.3-based project of mine :-)

Well, well,this opens a lot of doors! (including doc comments with links inside them for clickable cross refs, like we had in squeak)

Now, it is going to be used with Tx stuff ?

Phil

Short answer: no.
Long answer:  we looking forward to provide similar (or even better :) ) functionality.


--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: TextAttribute, TextAction and TextDoIt or TextURL: not working

philippeback
Aaaah ;-)

Hypertext abilities: a must have, especially since we'll have that super AST-style source code thingy in Pharo4.

---
Philippe Back
Dramatic Performance Improvements
Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027
Blog: http://philippeback.be | Twitter: @philippeback

High Octane SPRL
rue cour Boisacq 101 | 1301 Bierges | Belgium

Pharo Consortium Member - http://consortium.pharo.org/
Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com
Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
 



On Wed, Nov 6, 2013 at 11:22 AM, Igor Stasenko <[hidden email]> wrote:



On 5 November 2013 22:56, [hidden email] <[hidden email]> wrote:
,Ooooohhh!!!!

I guess I'll restart work on that old 1.3-based project of mine :-)

Well, well,this opens a lot of doors! (including doc comments with links inside them for clickable cross refs, like we had in squeak)

Now, it is going to be used with Tx stuff ?

Phil

Short answer: no.
Long answer:  we looking forward to provide similar (or even better :) ) functionality.


--
Best regards,
Igor Stasenko.