[Seaside] callback wierdness

Richard Huxton dev at archonet.com
Thu Aug 10 15:06:10 UTC 2006


Keith Hodges wrote:
> I wrote something like this
> 
> html anchor callback: [ html text: 'hello' ] text: 'world'.
> 
> and the output was
> 
> 'helloworld'
> 
> i.e. the result of the callback was being rendered before I had clicked 
> on the anchor.

This will not work, because you are asking the callback to render 
outside of the rendering phase. What you want is something like:

initialize
	...
	myStatus := 'hello'

renderContentOn: html
	html anchor callback: [ myStatus := 'goodbye' ] text: ' world'.

Then, the callback will set the status and in the render cycle you will 
receive a "renderContentOn" message on your component again. I made this 
same mistake at the start.

> It turns out that in WAConfiguration editor is renderered on 
> WARenderCanvas, when I do
> 
> html anchor callback: [ self call: WAMyComponent new ] text: 'clickme'.
> 
> and I click on the anchor, the resulting
> 
> WAMyComponent's rendering is on WAHtmlRenderer.
> 
> and this is giving the above behaviour. I would much rather that call: 
> wired my component to render using WARenderCanvas 

Your component needs to choose how it renders itself. By setting its 
rendererClass method. Or, you have one default for all your components, 
by setting it in a superclass. So, you should add
	rendererClass
		^'WARenderCanvas'
to WAMyComponent.

 > but this setting seams
> to be picked up from WAPresenter in the guts of the inner workings of 
> call: , hence my question should I be using call: or has it been 
> replaced with an alternative?

HTH
-- 
   Richard Huxton
   Archonet Ltd


More information about the Seaside mailing list