Receiving the Answer of a Child Component?

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

Receiving the Answer of a Child Component?

Michael Gorsuch
Newbie alert, folks.

My root component is a subclass of WATask (named GHStart), and the
first move in my workflow is basically this:

user := self call: (GHWelcome new)

GHWelcome renders two child component: one that allows users to
register, and one that allows them to login.  Might as well serve both
on one page, right?

So, the essence of my problem:  when a user logs in or creates a new
account, those child components need to return the user object,
causing the GHWelcome instance to #answer the originating #call from
the instance of GHStart.

Any ideas as to how I can do this?  Please be gentle, as I am rather
new to Smalltalk in general (I hail from Ruby).  There might already
be a tutorial that I am missing, or this may have already been
answered on the list before, I just don't know the right thing to
search for.

It seem inappropriate to have the children talk to the parent,
GHWelcome, as that pretty much throws the idea of reusability out the
window...

Thanks,

Michael Gorsuch

--
Styled Bits 2.0: They're Mostly Broken, But I Try
http://www.styledbits.com
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Receiving the Answer of a Child Component?

Andrius Paulavicius
Components can intercept answers of child component. You should add something
like "self onAnswer: [:ans | self answer: ans]" to GHWelcome initialize

> Newbie alert, folks.
>
> My root component is a subclass of WATask (named GHStart), and the
> first move in my workflow is basically this:
>
> user := self call: (GHWelcome new)
>
> GHWelcome renders two child component: one that allows users to
> register, and one that allows them to login.  Might as well serve both
> on one page, right?
>
> So, the essence of my problem:  when a user logs in or creates a new
> account, those child components need to return the user object,
> causing the GHWelcome instance to #answer the originating #call from
> the instance of GHStart.
>
> Any ideas as to how I can do this?  Please be gentle, as I am rather
> new to Smalltalk in general (I hail from Ruby).  There might already
> be a tutorial that I am missing, or this may have already been
> answered on the list before, I just don't know the right thing to
> search for.
>
> It seem inappropriate to have the children talk to the parent,
> GHWelcome, as that pretty much throws the idea of reusability out the
> window...
>
> Thanks,
>
> Michael Gorsuch
>
> --
> Styled Bits 2.0: They're Mostly Broken, But I Try
> http://www.styledbits.com
> _______________________________________________
> 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: Receiving the Answer of a Child Component?

Michael Gorsuch
On 6/9/07, Andrius Paulavicius <[hidden email]> wrote:
> Components can intercept answers of child component. You should add something
> like "self onAnswer: [:ans | self answer: ans]" to GHWelcome initialize

Ah!  Thanks so much!

I ended up having to do add these to GHWelcome initialize:

userLoginForm := GHUserLogin new onAnswer: [:ans| self answer: ans];yourself.
userNewForm := GHUserNew new onAnswer: [:ans| self answer ansj; yourself.

I appreciate the help: it put me on the right track!

Thanks again,

Michael Gorsuch

-
Styled Bits 1.0: Fresh Markup Served Daily
http://www.styledbits.com
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Receiving the Answer of a Child Component?

Philippe Marschall
2007/6/9, Michael Gorsuch <[hidden email]>:

> On 6/9/07, Andrius Paulavicius <[hidden email]> wrote:
> > Components can intercept answers of child component. You should add something
> > like "self onAnswer: [:ans | self answer: ans]" to GHWelcome initialize
>
> Ah!  Thanks so much!
>
> I ended up having to do add these to GHWelcome initialize:
>
> userLoginForm := GHUserLogin new onAnswer: [:ans| self answer: ans];yourself.
> userNewForm := GHUserNew new onAnswer: [:ans| self answer ansj; yourself.
>
> I appreciate the help: it put me on the right track!

You might also want to have a look at announcements:
http://onsmalltalk.com/programming/smalltalk/maintaining-loose-coupling-in-seaside-components/

Cheers
Philippe

> Thanks again,
>
> Michael Gorsuch
>
> -
> Styled Bits 1.0: Fresh Markup Served Daily
> http://www.styledbits.com
> _______________________________________________
> 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