calls within Children components

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

calls within Children components

Kevin Lacobie
I'm having a problem with call: not working for an anchor within a  
child component.  The same call: does work for the parent component,  
so it is leaving me puzzled; perhaps I'm not doing something right  
with children?

Here's the callback in question, inside renderContentOn: of the child  
component:

        html anchor callback: [self editArgument: myArgument];  with:  
myArgument title.

and, the editArgument method:

editArgument: anArgument

        self editor doc: anIBISDoc.
        self call: self editor

editor
        ^myEditor ifNil: [myEditor := IBISDocumentEditor new]

myEditor is added to the children OrderedCollection upon initialization.

IBISDocumentEditor is a WAComponent.   When the anchor above is  
clicked, I've confirmed that editor doc: is invoked, but it never  
makes it to self call:   .  More precisely, IBISDocumentEditor's  
renderContentOn: is never called.  The same pattern of code works just  
fine when used in the parent component, so I'm puzzled.  Ideas?

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

Re: calls within Children components

Julian Fitzell-2
Hi Kevin,

Nothing springs obviously to mind from what you've shown other than to
mention that lazy initialization is problematic with components, but
if you're sure the editor is being created in #initialize then that
should be fine. Mind you, if that's the case, why why not just put the
initialization directly within #initialize?

My advice is to create some new test components and find the smallest,
simplest possible example you can that demonstrates the problem. If
doing so doesn't allow you to find the problem yourself, you can post
a fileout or an .mcz of the example here for someone to try - that
will almost certainly allow someone to quickly figure out what's
holding you up.

Julian

On Wed, Jul 29, 2009 at 8:45 AM, Kevin Lacobie<[hidden email]> wrote:

> I'm having a problem with call: not working for an anchor within a child
> component.  The same call: does work for the parent component, so it is
> leaving me puzzled; perhaps I'm not doing something right with children?
>
> Here's the callback in question, inside renderContentOn: of the child
> component:
>
>       html anchor callback: [self editArgument: myArgument];  with:
> myArgument title.
>
> and, the editArgument method:
>
> editArgument: anArgument
>
>        self editor doc: anIBISDoc.
>        self call: self editor
>
> editor
>        ^myEditor ifNil: [myEditor := IBISDocumentEditor new]
>
> myEditor is added to the children OrderedCollection upon initialization.
>
> IBISDocumentEditor is a WAComponent.   When the anchor above is clicked,
> I've confirmed that editor doc: is invoked, but it never makes it to self
> call:   .  More precisely, IBISDocumentEditor's renderContentOn: is never
> called.  The same pattern of code works just fine when used in the parent
> component, so I'm puzzled.  Ideas?
>
> Kevin
> _______________________________________________
> 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: calls within Children components

Kevin Lacobie
In reply to this post by Kevin Lacobie
Thanks Julian,

Here's a quick test case I whipped out, demonstrating my current child  
problem, in IBISTestView.  I'm sure I'm missing something obvious ...



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

IBISDoc.st (1K) Download Attachment
IBISDocumentEditor.st (1K) Download Attachment
IBISTestView.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: calls within Children components

Julian Fitzell-2
Kevin, I'll try to have a look at this tonight if nobody beats me to it.

Julian

On Wed, Jul 29, 2009 at 10:02 AM, Kevin Lacobie<[hidden email]> wrote:

> Thanks Julian,
>
> Here's a quick test case I whipped out, demonstrating my current child
> problem, in IBISTestView.  I'm sure I'm missing something obvious ...
>
>
>
> _______________________________________________
> 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: calls within Children components

Ramon Leon-5
In reply to this post by Kevin Lacobie
Kevin Lacobie wrote:
> Thanks Julian,
>
> Here's a quick test case I whipped out, demonstrating my current child
> problem, in IBISTestView.  I'm sure I'm missing something obvious ...

Look at your render..

renderContentOn: html
        |childview|
   html paragraph: [html anchor callback: [self edit]; with: myDoc title].
   myDoc docs do: [:each |
           childview := IBISTestView new doc: each.
           self children add: childview.
           html render: childview
   ]
                       

You're modifying the state of the component in a render, you can't do
that.  You need to add children before the render phase.  You should do
this all in initialize.  Restrict yourself to creating new views to
either in a callback, or in initialization and you'll avoid such issues.

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

Re: Re: calls within Children components

Ramon Leon-5
In reply to this post by Kevin Lacobie
Kevin Lacobie wrote:
> Thanks Julian,
>
> Here's a quick test case I whipped out, demonstrating my current child
> problem, in IBISTestView.  I'm sure I'm missing something obvious ...

Also, see my post

http://onsmalltalk.com/terse-guide-to-seaside

and check the section at the bottom for things to avoid.


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

Re: calls within Children components

Kevin Lacobie
In reply to this post by Kevin Lacobie
 >You're modifying the state of the component in a render, you can't do
 >that.

Thanks, Ramon!     So, lesson is, make your children before you show  
them :)

That fixed my problem.  I think I managed to get away with creating  
children in renderContentOn: before, not realizing it was creating a  
problem.

Kevin
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside