Ajax callback question: how to update component tree before #children gets called?

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

Ajax callback question: how to update component tree before #children gets called?

Sophie424
When this anchor is pressed:

html anchor
  onClick: (html updater
    id: someId ;
    callback: [ : r |
      self updateComponentTree.
      self renderSomethingOn: r]);
   with: 'do' ].

I find that #children is called BEFORE my #updateComponentTree.

OK, so I think that #children probably has to be called before
#renderSomethingOn.

My question: when the anchor is clicked, how do I arrange for
    self updateComponentTree
to execute before #children? Is there a way to have a separate callback for
  - updates to component tree (before #children) Vs.
  - re-rendering callback (after #children)

Thanks,

Sophie



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

Re: Ajax callback question: how to update component tree before #children gets called?

Lukas Renggli
> My question: when the anchor is clicked, how do I arrange for
>     self updateComponentTree
> to execute before #children? Is there a way to have a separate callback for
>   - updates to component tree (before #children) Vs.
>   - re-rendering callback (after #children)

Callbacks are always executed in the context of the defining
component. So when callbacks are processed the whole component tree is
traversed (using the information from #children) and the callbacks are
triggered in the right order in the context of their owning component.
That's why you get 'Components not found while processing callbacks'
when you fail to specify #children correctly.

I don't quite understand why you need to update the children before
the callbacks are processed? Maybe you can provide a running example?

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: Ajax callback question: how to update component treebefore #children gets called?

Sophie424
"Lukas Renggli" <[hidden email]> wrote in message
> I don't quite understand why you need to update the children before
> the callbacks are processed? Maybe you can provide a running example?

I have a tab panel (not SUTabPanel) with closable tabs.

Its #children just returns the component in its currently #selected tab.

When the #selected tab is closed, I want the following to happen:
  1. remove #selected tab and its component from the component tree
  2. change #selected to the next available tab (if any)
     Note: #children will changed after 2.
  3. Re-render the tab panel downwards

I think this requires doing 1, then #children, then 3.

Am I approaching this wrong?

Thanks!

Sophie



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

Re: Ajax callback question: how to update component treebefore #children gets called?

Sophie424
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message
> So when callbacks are processed the whole component tree is
> traversed (using the information from #children)

I think I understand the explanation. I'm still trying to figure out why my
app code itself dies (and I'm not sure my tiny example captures the problem
I am having ... I can now get the failure predictably on my actual app, but
that would be a bit much to post :-(

I will dig further ... this has been a quite difficult one for me.

Many thanks - Sophie



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

Re: Re: Ajax callback question: how to update component treebefore #children gets called?

Lukas Renggli
> I am having ... I can now get the failure predictably on my actual app, but
> that would be a bit much to post :-(

What is the failure you get?

> I will dig further ... this has been a quite difficult one for me.

Usually it is a good strategy to make sure that the application works
well without AJAX and then later on add that functionality, if
necessary.

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: Ajax callback question: how to update component treebefore #children gets called?

Sophie424
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message

> Callbacks are always executed in the context of the defining
> component. So when callbacks are processed the whole component tree is
> traversed (using the information from #children) and the callbacks are
> triggered in the right order in the context of their owning component.

Given a component tree with [zoom] callback operation on C3:
C1
  C2
    C3 [zoom]
can the zoom callback on C3
    C3>>zoom
safely add a child component to C1? From your explanation it appears that
#children has already been called on C1 & C2, before C3#zoom matches the
callback search and executes ... and changes C1>>children ... a recipe for
trouble?

In my app an N-level deep sub-component, on 'Zoom', adds a new tab to the
top-level tab panel. After this then things appear to break with
Component-Not-Found.

Please tell me there is a way to do this without losing Ajax :-)

Thanks - Sophie



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

Re: Re: Ajax callback question: how to update componenttreebefore #children gets called?

Sophie424
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message
> What is the failure you get?

In my app an N-level deep sub-component, on 'Zoom', adds a new tab to the
top-level tab panel. After this then things appear to break with
Component-Not-Found.

(Sorry, our posts may have crossed earlier ... this from my other post:)

Given a component tree with [zoom] callback operation on C3:
C1
  C2
    C3 [zoom]
can the zoom callback on C3
    C3>>zoom
safely add a child component to C1? From your explanation it appears that
#children has already been called on C1 & C2, before C3#zoom matches the
callback search and executes ... and changes C1>>children ... a recipe for
trouble?

Many Thanks - Sophie



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

Re: Re: Ajax callback question: how to update component treebefore #children gets called?

Lukas Renggli
In reply to this post by Sophie424
> Please tell me there is a way to do this without losing Ajax :-)

The question is, does your code works without AJAX?

I did not ask to remove AJAX. It is just that if your problem might
not be related to AJAX at all.

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: Re: Ajax callback question: how to update componenttreebefore #children gets called?

Sophie424
"Lukas Renggli" <[hidden email]> wrote in message

> The question is, does your code works without AJAX?

Yes, it works without Ajax, and fails with Ajax.

I just made a test (attached fileout) of child component modifying parent
component structure.
- Seaside 2.8 + SU, Squeak 3.9
- Hacks TheTabTestPanel as a global for the test
- Try non-Ajax link, then click on tabs;
- Try Ajax-links, then click on tabs. Only difference is Ajax.

Thanks - Sophie


begin 666 C1C2.st
M3V)J96-T('-U8F-L87-S.B C04I486(-"6EN<W1A;F-E5F%R:6%B;&5.86UE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@:6YI=&EA;&EZ92$`
`
end


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

Re: Re: Re: Ajax callback question: how to update componenttreebefore #children gets called?

Lukas Renggli
> > The question is, does your code works without AJAX?
>
> Yes, it works without Ajax, and fails with Ajax.

Ok, I will have a look.

> begin 666 C1C2.st
> M3V)J96-T('-U8F-L87-S.B C04I486(-"6EN<W1A;F-E5F%R:6%B;&5.86UE
> M<SH@)VQA8F5L(&-O;7!O;F5N="<-"6-L87-S5F%R:6%B;&5.86UE<SH@)R<-
> M"7!O;VQ$:6-T:6]N87)I97,Z("<G#0EC871E9V]R>3H@)T,Q0S(G(0T-(4%*

How do I get that noise of characters into my Squeak image?

Lukas :-S

--
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: Re: Re: Ajax callback question: how to update componenttreebefore #children gets called?

Stefan Schmiedl
On Fri, 8 Feb 2008 12:17:21 +0100
"Lukas Renggli" <[hidden email]> wrote:

> > begin 666 C1C2.st
> > M3V)J96-T('-U8F-L87-S.B C04I486(-"6EN<W1A;F-E5F%R:6%B;&5.86UE
> > M<SH@)VQA8F5L(&-O;7!O;F5N="<-"6-L87-S5F%R:6%B;&5.86UE<SH@)R<-
> > M"7!O;VQ$:6-T:6]N87)I97,Z("<G#0EC871E9V]R>3H@)T,Q0S(G(0T-(4%*
>
> How do I get that noise of characters into my Squeak image?

uudecode works wonders when being fed this.

ahhh... those were the times :-)

s.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Ajax callback question: how to update componenttreebefore #children gets called?

Lukas Renggli
> uudecode works wonders when being fed this.

Geeky stuff ;-)

With the uuencoded patch I cannot re-produce the errors anymore:

- declare all tab components as children (!)
- when a tab panel is removed, also update the tab panel
- avoid throwing an error when the same tab panel is close twice
- removed unknown message-send from #selected (Sophie probably wants
to skip this step)

Cheers,
Lukas

begin 644 C2C3.cs
M)T9R;VT@4W%U96%K,RXY(&]F(#<@3F]V96UB97(@,C`P-B!;;&%T97-T('5P
M9&%T93H@(S<P-C==(&]N(#@@1F5B<G5A<GD@,C`P."!A="`Q.C0P.C$S('!M
M)R$-#2%!2E1A8E!A;F5L(&UE=&AO9'-&;W(Z("=A<R!Y970@=6YC;&%S<VEF
M:65D)R!S=&%M<#H@)VQR(#(O."\R,#`X(#$S.C,R)R$-8VAI;&1R96X-"5X@
M=&%B<R!C;VQL96-T.B!;(#IE('P@92!C;VUP;VYE;G0@72$@(0T-(4%*5&%B
M4&%N96P@;65T:&]D<T9O<CH@)V%S('EE="!U;F-L87-S:69I960G('-T86UP
M.B`G;'(@,B\X+S(P,#@@,3,Z,S<G(0UR96UO=F5486(Z(&%486(-"2AT86)S
M('-I>F4@/B`Q*2!I9E1R=64Z(%MT86)S(')E;6]V93H@851A8B!I9D%B<V5N
M=#H@6R!>('-E;&8@75TN#0DH<V5L96-T960@/3T@851A8BD@:694<G5E.B!;
M#0D)<V5L96-T960@.CT@;FEL+@T)"7-E;&8@<V5L96-T960@72$@(0T-(4%*
M5&%B4&%N96P@;65T:&]D<T9O<CH@)V%S('EE="!U;F-L87-S:69I960G('-T
M86UP.B`G;'(@,B\X+S(P,#@@,3,Z,S8G(0UR96YD97)486)S3VXZ(&AT;6P-
M"71A8G,@9&\Z(`T)"5L@.B!E86-H('P@#0D):'1M;"!L:7-T271E;0T)"0EC
M;&%S<SH@)W1A8B<@+"`H*'-E;&8@<V5L96-T960@/3T@96%C:"D):694<G5E
M.B!;("<@86-T:79E)R!=(&EF1F%L<V4Z(%L@)R<@72D@.PT)"0EW:71H.B`-
M"0D)"5L@:'1M;"!S<&%N.B`-"0D)"0E;:'1M;"!A;F-H;W(-"0D)"0EO;D-L
M:6-K.B`H:'1M;"!U<&1A=&5R(&ED.B!I9"`[#0D)"0D)"0EC86QL8F%C:SH@
M6R`Z('(@?"`-"0D)"0D)"0ES96QF('-E;&5C=&5D.B!E86-H+@T)"0D)"0D)
M"7-E;&8@<F5N9&5R0F]D>4]N.B!H=&UL72D@.PT)"0D)"7=I=&@Z(&5A8V@@
M;&%B96P@=F%L=64N#0D)"0EH=&UL(&%N8VAO<@T)"0D)"6]N0VQI8VLZ("AH
M=&UL('5P9&%T97(@:60Z(&ED(#L-"0D)"0D)8V%L;&)A8VLZ(%L@.B!R('P@
M#0D)"0D)"0D)<V5L9B!R96UO=F5486(Z(&5A8V@N#0D)"0D)"0D)<V5L9B!R
M96YD97)";V1Y3VXZ(&AT;6Q=*2`[#0D)"0D)=VET:#H@)W@G(%U=72$@(0T-
M(4%*5&%B4&%N96P@;65T:&]D<T9O<CH@)V%S('EE="!U;F-L87-S:69I960G
M('-T86UP.B`G;'(@,B\X+S(P,#@@,3,Z,C@G(0US96QE8W1E9`T)7B!S96QE
M8W1E9"!I9DYI;#H@6W-E;&5C=&5D(#H]('1A8G,@9FER<W1=(&EF3F]T3FEL
1.B!;<V5L96-T961=(2`A#0T`
`
end


--
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: Re: Re: Ajax callback question: how to updatecomponenttreebefore #children gets called?

Sophie424
"Lukas Renggli" <[hidden email]> wrote in message

> - declare all tab components as children (!)

Yes, this does work, but I don't understand why it is necessary.
#renderContentOn: will only #render: the #selected tab, never any of the
others.

(I mainly want to understand the right way ... but also worry about scale:
does the total size of the component tree matter, or just the size of
#children of any one node?)

> - when a tab panel is removed, also update the tab panel
> - avoid throwing an error when the same tab panel is close twice
> - removed unknown message-send from #selected (Sophie probably wants
> to skip this step)

Yes.

Thank you very much!

Sophie



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

Re: Re: Re: Re: Ajax callback question: how to updatecomponenttreebefore #children gets called?

Lukas Renggli
> > - declare all tab components as children (!)
>
> Yes, this does work, but I don't understand why it is necessary.
> #renderContentOn: will only #render: the #selected tab, never any of the
> others.

Let's face it, it is complicated and Seaside doesn't get it quite right ;-)

Callbacks are normally processed in the context of the component that
defines them (the owner). In the code below you directly call a
foreign rendering method:

      html div: [html anchor
                onClick: (html updater
                        id: TheTabTestPanel id;
                        callback: [:r |
                                TheTabTestPanel add: (SUCounterTest new) label: 'another'.
                                TheTabTestPanel renderBodyOn: r]);
                with: 'AJAX add from nested SUCounter'.].

Then the problem is that the owner of all callbacks in your tab panel
is the SUCounter that just disappeared. And there is nobody that takes
care of these callbacks. Bummer.

Seaside 2.9 already takes a step in the direction of fixing that kind
of problems. It supports so called 'homeless callbacks' that can be
incredibly useful when you want define a callback from a file-library
(or something else that is not the callback processing chain). I guess
this solution could be applied to this problem as well and would solve
many sleepless nights. Thanks for providing such a nice example to
reproduce this problem.

> (I mainly want to understand the right way ... but also worry about scale:
> does the total size of the component tree matter, or just the size of
> #children of any one node?)

This is usually not a problem, if you have a moderate number of children.

> > - when a tab panel is removed, also update the tab panel
> > - avoid throwing an error when the same tab panel is close twice
> > - removed unknown message-send from #selected (Sophie probably wants
> > to skip this step)
>
> Yes.

Pay attention to use the right renderer. Even if it mostly works, I
just noticed that there are some places where you use html within an
AJAX callback.

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: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

Sophie424
"Lukas Renggli" <[hidden email]> wrote in message

> the owner of all callbacks in your tab panel
> is the SUCounter that just disappeared. And there is
> nobody that takes care of these callbacks. Bummer.

Ah. This could make some kinds of Ajax difficult.

> I guess
> this solution could be applied to this problem as well and would solve
> many sleepless nights.

That would be great! Callback problems are the most difficult part of
Seaside for me to debug.

> Thanks for providing such a nice example to
> reproduce this problem.

My pleasure, its good to find some good side to my bad programming :-)

Below might be another pattern: an operation on (the domain model of) a
parent component is actually presented on a child component (the parent
configures the child).

House>>deleteRoom: aRoom
HouseComponent (model=house)
  RoomComponent 1 (model=r1)
    ['delete'->[house deleteRoom:r1.
                rend render: houseComponent]]
  RoomComponent 2 (model=r2)
    ['delete'->[house deleteRoom:r2.
                rend render: houseComponent]]

e.g. Desktop compound-document/component systems allow elements to negotiate
with parents/children/root about where menus appear. It would be awesome if
Seaside's architecture enabled similar composition flexibility. It would
mean that...
  > Callbacks are normally processed in the context of the component that
  > defines them (the owner).

... the component that presents a callback need not be the one that
"defined/owns" it. Not so much "homeless", more like "bind-and-relocate"
(bind: r1 or r2, relocate: from house to r1, r2).

Perhaps seaside components have a special notion of "environment" that could
be made explicit?

> This is usually not a problem, if you have a moderate number of children.

Good to know.

> Pay attention to use the right renderer. Even if it mostly works, I
> just noticed that there are some places where you use html within an
> AJAX callback.

Yikes! Even *I* should know better than to do that. A Lint smell?

As always, with many thanks.

Sophie



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

Re: Re: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

Lukas Renggli
>   > Callbacks are normally processed in the context of the component that
>   > defines them (the owner).
>
> ... the component that presents a callback need not be the one that
> "defined/owns" it. Not so much "homeless", more like "bind-and-relocate"
> (bind: r1 or r2, relocate: from house to r1, r2).

Yes, why not. The updater could be written like:

     html updater
          id: TheTabTestPanel id;
          callback: [:r |
               r withOwner: anotherComponent do: [
                    anotherComponent add: (SUCounterTest new) label: 'another'.
                    anotherComponent renderBodyOn: r ] ]);
          with: 'AJAX add from nested SUCounter' ]

The question is rather, if I want to explain that to anybody ;-)

> > Pay attention to use the right renderer. Even if it mostly works, I
> > just noticed that there are some places where you use html within an
> > AJAX callback.
>
> Yikes! Even *I* should know better than to do that. A Lint smell?

The latest version of Slime detects that kind of bug. Thanks for the idea.

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: Re: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

Philippe Marschall
2008/2/9, Lukas Renggli <[hidden email]>:

> >   > Callbacks are normally processed in the context of the component that
> >   > defines them (the owner).
> >
> > ... the component that presents a callback need not be the one that
> > "defined/owns" it. Not so much "homeless", more like "bind-and-relocate"
> > (bind: r1 or r2, relocate: from house to r1, r2).
>
> Yes, why not. The updater could be written like:
>
>      html updater
>           id: TheTabTestPanel id;
>           callback: [:r |
>                r withOwner: anotherComponent do: [
>                     anotherComponent add: (SUCounterTest new) label: 'another'.
>                     anotherComponent renderBodyOn: r ] ]);
>           with: 'AJAX add from nested SUCounter' ]
>
> The question is rather, if I want to explain that to anybody ;-)

Write a book about it  ;-)

Cheers
Philippe

> > > Pay attention to use the right renderer. Even if it mostly works, I
> > > just noticed that there are some places where you use html within an
> > > AJAX callback.
> >
> > Yikes! Even *I* should know better than to do that. A Lint smell?
>
> The latest version of Slime detects that kind of bug. Thanks for the idea.
>
> Lukas
>
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

Vladimir Pogorelenko
>>>
>>
>>     html updater
>>          id: TheTabTestPanel id;
>>          callback: [:r |
>>               r withOwner: anotherComponent do: [
>>                    anotherComponent add: (SUCounterTest new) label:  
>> 'another'.
>>                    anotherComponent renderBodyOn: r ] ]);
>>          with: 'AJAX add from nested SUCounter' ]
>>
>> The question is rather, if I want to explain that to anybody ;-)
>
> Write a book about it  ;-)

Book would be time-consuming and expensive. :-)

But small pattern booklet showing people how to solve their tasks in  
Seaside would be very useful.

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

Re: Re: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

cedreek
In reply to this post by Lukas Renggli
> >   > Callbacks are normally processed in the context of the component that

> >   > defines them (the owner).
> >
> > ... the component that presents a callback need not be the one that
> > "defined/owns" it. Not so much "homeless", more like "bind-and-relocate"
> > (bind: r1 or r2, relocate: from house to r1, r2).
>
> Yes, why not. The updater could be written like:
>
>      html updater
>           id: TheTabTestPanel id;
>           callback: [:r |
>                r withOwner: anotherComponent do: [
>                     anotherComponent add: (SUCounterTest new) label: 'another'.
>                     anotherComponent renderBodyOn: r ] ]);
>           with: 'AJAX add from nested SUCounter' ]
>
> The question is rather, if I want to explain that to anybody ;-)
Maybe the TabTestPanel could go in the examples as a start ?
Would you plan adding this feature ? Is it complementary to the
homeless callback ?
Maybe changing the callback method name would help to understand.,
maybe having a keyword (#callback:inComponent:).

Anyway, thanks for the explanation and discussion. This is always interesting :)

Cédrick

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

Re: Re: Re: Re: Re: Ajax callback question: how toupdatecomponenttreebefore #children gets called?

Lukas Renggli
> > The question is rather, if I want to explain that to anybody ;-)
>
> Maybe the TabTestPanel could go in the examples as a start ?
> Would you plan adding this feature ? Is it complementary to the
> homeless callback ?

Maybe, if we find a satisfactory solution.

> Maybe changing the callback method name would help to understand.,
> maybe having a keyword (#callback:inComponent:)

That doesn't work, because a callback could render to many components.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
12