Morphic again...

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

Morphic again...

Ankh'nAton
Hellö everybody!

To handle i.e. the left mouse button click, Morphic assumes to you to
add the method 'mouseClickLeft' to the object of interest. How can
this be achieved with amber best? AFAIR Smalltalk is about
instanciation of classes, but not about dynamic prototyping, is it?

Thanxalot
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Ankh'nAton
PS: I use *morphic.js* from Jens Mönig
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Guido Stepken

I also use lively2 for nice animations embedded in html:

http://lively-kernel.org/repository/webwerkstatt/

Second incarnation of Ingalls lively from HPI, Germany, Berlin with support from Dan Ingalls (saw him there working on this). Leaner, faster, you may now also use html and css, not just canvas or svg, Smalltalk syntax wrapping is also straight forward.

http://www.hpi.uni-potsdam.de/hirschfeld/projects/livelyfabrik/index.html

For all, who want to do nice educational things, e.g. animate e-books, like Apple does it with iTunesU, iBooks 2, go for lively2! Or lively2 + monocle epub reader:

http://monocle.inventivelabs.com.au/

If you rather want to write easy deployable, complex webapps, go for Jens Mönig's Morphic.js.

In both cases programming with Amber Smalltalk is an ease, thanks to Amber's JSObjectProxy.

Even older examples from lively can be accessed from Smalltalk easily, see clock.xhtml example from:

http://lively-kernel.org/repository/webwerkstatt/demos/

I leave that as 'homework' for you now... :-)

Have fun with Amber Smalltalk!

Guido Stepken

Am 31.01.2012 22:26 schrieb "Tom" <[hidden email]>:
PS: I use *morphic.js* from Jens Mönig
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Guido Stepken
In reply to this post by Ankh'nAton

Forgot to mention MathJax:

http://www.mathjax.org/demos/mathml-samples/

if you want to include sophisticated math formulas into your educational html - pages or epubs with monocle epub reader and Amber.

Have fun, Guido Stepken

Am 31.01.2012 22:26 schrieb "Tom" <[hidden email]>:
PS: I use *morphic.js* from Jens Mönig
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Ankh'nAton
In reply to this post by Guido Stepken


On 1 Feb., 07:08, Guido Stepken <[hidden email]> wrote:

[Lively2 with canvas and html widgets]

Gosh! That's a lot of work done there.

For now I'd prefer to stay with *amber* and *morphic.js* and watch the
evolution of both ;)

Cheers...
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Nicolas Petton
In reply to this post by Ankh'nAton
In Amber you can access JS objects seemlessly. You have to know that:

1. A block closure in Amber is a JS function
2. JS Objects are accessed as instances of JSObjectProxy.

To Dynamically add a function (I'm adding 'helloWorld' to the window
object):

window at: 'helloWorld' put: [ window alert: 'hello world' ]

with params:

window at: 'ask' put: [:value | window confirm: value ]


then you can use it like this:

window helloWorld.
window ask: 'how are you today?'


HTH,
Nico

On Tue, 2012-01-31 at 13:26 -0800, Tom wrote:
> PS: I use *morphic.js* from Jens Mönig


Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Nicolas Petton
On Sat, 2012-02-04 at 12:32 +0100, Nicolas Petton wrote:

> window at: 'ask' put: [:value | window confirm: value ]

Oh, and of course you can get the result:

| answer |
answer := window ask: 'Do you like Amber?'.
answer inspect -> true

Nico

Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Ankh'nAton
In reply to this post by Nicolas Petton
Hi and thank You!

Actually this didn't work in 0.91 with a BoxMorph i.e. - I had to go
like:

frame := BoxMorph new.
(JSObjectProxy on: frame) at: 'mouseClickLeft' put: [Browser open].

Regards...

On 4 Feb., 12:32, Nicolas Petton <[hidden email]> wrote:

> In Amber you can access JS objects seemlessly. You have to know that:
>
> 1. A block closure in Amber is a JS function
> 2. JS Objects are accessed as instances of JSObjectProxy.
>
> To Dynamically add a function (I'm adding 'helloWorld' to the window
> object):
>
> window at: 'helloWorld' put: [ window alert: 'hello world' ]
>
> with params:
>
> window at: 'ask' put: [:value | window confirm: value ]
>
> then you can use it like this:
>
> window helloWorld.
> window ask: 'how are you today?'
>
> HTH,
> Nico
>
>
>
>
>
>
>
> On Tue, 2012-01-31 at 13:26 -0800, Tom wrote:
> > PS: I use *morphic.js* from Jens Mönig
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Ankh'nAton
Hi!

I don't know what went wrong whith my earlier attemps, but now it
works as expected. There is no need to instanciate a new JSObjectProxy
anymore. So...

box := BoxMorph new.
box at: 'mouseClickLeft' put: [Browser open].

...is doing well.

Regards...


On 4 Feb., 14:05, Tom <[hidden email]> wrote:

> Hi and thank You!
>
> Actually this didn't work in 0.91 with a BoxMorph i.e. - I had to go
> like:
>
> frame := BoxMorph new.
> (JSObjectProxy on: frame) at: 'mouseClickLeft' put: [Browser open].
>
> Regards...
>
> On 4 Feb., 12:32, Nicolas Petton <[hidden email]> wrote:
>
>
>
>
>
>
>
> > In Amber you can access JS objects seemlessly. You have to know that:
>
> > 1. A block closure in Amber is a JS function
> > 2. JS Objects are accessed as instances of JSObjectProxy.
>
> > To Dynamically add a function (I'm adding 'helloWorld' to the window
> > object):
>
> > window at: 'helloWorld' put: [ window alert: 'hello world' ]
>
> > with params:
>
> > window at: 'ask' put: [:value | window confirm: value ]
>
> > then you can use it like this:
>
> > window helloWorld.
> > window ask: 'how are you today?'
>
> > HTH,
> > Nico
>
> > On Tue, 2012-01-31 at 13:26 -0800, Tom wrote:
> > > PS: I use *morphic.js* from Jens Mönig
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Hannes Hirzel
Hello again

Thank you for continuing experimenting with morphic.js

On 2/7/12, Tom <[hidden email]> wrote:

> Hi!
>
> I don't know what went wrong whith my earlier attemps, but now it
> works as expected. There is no need to instanciate a new JSObjectProxy
> anymore. So...
>
> box := BoxMorph new.
> box at: 'mouseClickLeft' put: [Browser open].
>
> ...is doing well.
How do you place the BoxMorph into the Morphic pane?

Regards
Hannes

P.S. more code snippets like this are welcome. It 'flattens' the
learning curve of other group members .....

> On 4 Feb., 14:05, Tom <[hidden email]> wrote:
>> Hi and thank You!
>>
>> Actually this didn't work in 0.91 with a BoxMorph i.e. - I had to go
>> like:
>>
>> frame := BoxMorph new.
>> (JSObjectProxy on: frame) at: 'mouseClickLeft' put: [Browser open].
>>
>> Regards...
>>
>> On 4 Feb., 12:32, Nicolas Petton <[hidden email]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > In Amber you can access JS objects seemlessly. You have to know that:
>>
>> > 1. A block closure in Amber is a JS function
>> > 2. JS Objects are accessed as instances of JSObjectProxy.
>>
>> > To Dynamically add a function (I'm adding 'helloWorld' to the window
>> > object):
>>
>> > window at: 'helloWorld' put: [ window alert: 'hello world' ]
>>
>> > with params:
>>
>> > window at: 'ask' put: [:value | window confirm: value ]
>>
>> > then you can use it like this:
>>
>> > window helloWorld.
>> > window ask: 'how are you today?'
>>
>> > HTH,
>> > Nico
>>
>> > On Tue, 2012-01-31 at 13:26 -0800, Tom wrote:
>> > > PS: I use *morphic.js* from Jens Mönig
>

AmberWithMorphic.js.1.PNG (41K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Morphic again...

Ankh'nAton
From that point all You need is...

  box show.
  world add: box.
  world changed.

Cheers..

On 7 Feb., 23:45, "H. Hirzel" <[hidden email]> wrote:

> Hello again
>
> Thank you for continuing experimenting with morphic.js
>
> On 2/7/12, Tom <[hidden email]> wrote:
>
> > Hi!
>
> > I don't know what went wrong whith my earlier attemps, but now it
> > works as expected. There is no need to instanciate a new JSObjectProxy
> > anymore. So...
>
> > box := BoxMorph new.
> > box at: 'mouseClickLeft' put: [Browser open].
>
> > ...is doing well.
>
> How do you place the BoxMorph into the Morphic pane?
>
> Regards
> Hannes
>
> P.S. more code snippets like this are welcome. It 'flattens' the
> learning curve of other group members .....
>
>
>
>
>
>
>
> > On 4 Feb., 14:05, Tom <[hidden email]> wrote:
> >> Hi and thank You!
>
> >> Actually this didn't work in 0.91 with a BoxMorph i.e. - I had to go
> >> like:
>
> >> frame := BoxMorph new.
> >> (JSObjectProxy on: frame) at: 'mouseClickLeft' put: [Browser open].
>
> >> Regards...
>
> >> On 4 Feb., 12:32, Nicolas Petton <[hidden email]> wrote:
>
> >> > In Amber you can access JS objects seemlessly. You have to know that:
>
> >> > 1. A block closure in Amber is a JS function
> >> > 2. JS Objects are accessed as instances of JSObjectProxy.
>
> >> > To Dynamically add a function (I'm adding 'helloWorld' to the window
> >> > object):
>
> >> > window at: 'helloWorld' put: [ window alert: 'hello world' ]
>
> >> > with params:
>
> >> > window at: 'ask' put: [:value | window confirm: value ]
>
> >> > then you can use it like this:
>
> >> > window helloWorld.
> >> > window ask: 'how are you today?'
>
> >> > HTH,
> >> > Nico
>
> >> > On Tue, 2012-01-31 at 13:26 -0800, Tom wrote:
> >> > > PS: I use *morphic.js* from Jens Mönig
>
>  AmberWithMorphic.js.1.PNG
> 40KAnzeigenHerunterladen