How to start a periodical as a consequence of an evaluator's callback

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

How to start a periodical as a consequence of an evaluator's callback

Leandro Pérez
Hi,
I need to start a periodical as a consequence of an action executed within an evaluator's callback. e.g.

html submitButton
        onClick: (html evaluator callback:[:script |
                        self doSomething.
                        "Here a periodical must be started"]);
        text:'Do something'.

I don´t know how to do that, any ideas??

Thanks a lot,
Leandro
Reply | Threaded
Open this post in threaded view
|

Re: How to start a periodical as a consequence of an evaluator's callback

Lukas Renggli
> html submitButton
>         onClick: (html evaluator callback:[:script |
>                         self doSomething.
>                         "Here a periodical must be started"]);
>         text:'Do something'.
>
> I don´t know how to do that, any ideas??

What about?

    html submitButton
        onClick: (html evaluator callback: [ :script |
             self doSomething.
             script add: (html periodical
                  id: 'foo';
                  callback: [ :r | ... ]) ]);
        text: 'foo'

The way the periodical updater is instantiated is a bit ugly right
now. A long time ago I started to write a factory object that would
allow you to instantiate any Scriptaculous objects from any context,
however I never really found the time to finish it even there is not
much missing. I have to take another look at this ...

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start a periodical as a consequence of an evaluator's callback

Leandro Pérez
Lukas Renggli wrote
> html submitButton
>         onClick: (html evaluator callback:[:script |
>                         self doSomething.
>                         "Here a periodical must be started"]);
>         text:'Do something'.
>
> I don´t know how to do that, any ideas??

What about?

    html submitButton
        onClick: (html evaluator callback: [ :script |
             self doSomething.
             script add: (html periodical
                  id: 'foo';
                  callback: [ :r | ... ]) ]);
        text: 'foo'
Excellent!! it worked greatly

Lukas Renggli wrote
The way the periodical updater is instantiated is a bit ugly right
now. A long time ago I started to write a factory object that would
allow you to instantiate any Scriptaculous objects from any context,
however I never really found the time to finish it even there is not
much missing. I have to take another look at this ...

Cheers,
Lukas
That would be a nice thing to have :)

Thanks a lot again Lukas
Leandro