[Seaside] How do I call a method from renderContentOn:

Julian Fitzell julian at beta4.com
Tue Apr 13 09:14:45 CEST 2004


ld wrote:
> I'm new to Seaside.  It seems very powerful, if I could just understand
> it better. I have worked through the tutorial, and thought I'd practice
> by modifying the WACounter example to change the change 'interval' from
> the browser..  I added a 'interval' variable.  Then added a
> selectFromList to  'renderContentOn:' to  quickly change the interval
> that the counter is incremented/decremented by.
> 
> renderContentOn: html
>    html heading: count.
>    html anchorWithAction: [self increment] text: '++'.
>    html space.
>    html anchorWithAction: [self decrement] text: '--'.
>    html break.
>    html horizontalRule.
>    html text:  'Change the interval'.
>    html paragraph.
>    html form: [
>            html selectFromList: (1 to: 10) selected: interval callback:
> [:i | interval _ i].
>            html submitButton.
>        ].
>    html text: 'how do I call the setInterval from here?'.
> -------
> Next,  factored the form into a setInterval method:
> 
> setInterval: html
>    html text: interval.
>    html space.
>    html space.
>    html form: [
>            html selectFromList: (1 to: 10) selected: interval callback:
> [:i | interval _ i].
>            html submitButton.
>        ]
> -------
> My questions are:
> 1)  Is my factoring correct?

Should be fine though, by convention, I would rename #setInterval: to 
#renderIntervalOn: or something.

> 2)  How do I call this from  'renderContentOn:'  ?

just call "self setInterval: html" - you keep passing the renderer 
object on down to other rendering methods.

> Thanks for you patience with such simple questions.

Not a problem, let us know if you have more.

Julian



More information about the Seaside mailing list