Re: seaside Digest, Vol 68, Issue 38

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

Re: seaside Digest, Vol 68, Issue 38

r00t uk
Thanks James for the response and welcome! :)

I went back to the #callback: style and used #setFocus in both methods for testing.  With "...html textInput setFocus;...." present in both methods I know longer get a stack trace, but the focus ends up on the last receiver.  So definitely has something to do with #setFocus not being present.  I then re-wrote the methods using #on:of: style (see below), with #setFocus present in both, one or neither of the methods. It worked in all 3 scenarios and there are no cascades present.

renderCompanyTextInputOn: html
    self
        renderLabel: 'Company Name: '
        input: [
            html textInput on: #companyName of: self headDataModelView]
        output: self headDataModelView companyName
        on: html.

renderEmployeeTextInputOn: html
    self
        renderLabel: 'Employee Name: '
        input: [
            html textInput setFocus on: #employeeName of: self headDataModelView]
        output: self headDataModelView employeeName
        on: html.

The Seaside examples, which I used as references, can be found in Seaside-Tests-Functional WAInputElementContainer>>renderTextInputOn:, WAInputElementContainer>>renderTextInputExampleOn: etc. but these work.

Anyway, I will move forward using the #on:of: as these work and appear to achieve the same as the #callback: method.

Thanks for the help.

Regards
Adrian
   

Message: 7
Date: Sat, 30 Aug 2008 22:05:41 +0200
From: James Foster <[hidden email]>
Subject: Re: [Seaside] Newbie question
To: Seaside - general discussion <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

Hi Adrian,

I haven't tried your code myself, but a brief visual scan suggests at
least one problem that I've identified below...

On Aug 30, 2008, at 9:32 PM, r00t uk wrote:

> Hello All
>
> I am slowly working my way through Squeak and Seaside using "An
> Introduction to Seaside" and the Seaside examples as my learning
> guides.  I have come across an issue which I don't understand, and I
> am hoping someone could enlighten me as to what is going wrong.  The
> two methods below are called by
> MLHeadDataModelView>>renderContentOn:,  with
> MLHeadDataModelView>>renderCompanyTextInputOn: resulting in a
> MessageNotUnderstood: WARenderCanvas>>value: error.
>
> The instance methods are:
>
> MLHeadDataModelView>>renderCompanyTextInputOn: "This method
> generates the 'MessageNotUnderstood: WARenderCanvas>>value:' error"
> self
>         renderLabel: 'Company Name: '
>         input: [
>             html textInput;
>             value: self headDataModelView companyName;
>             callback: [:value | self headDataModelView companyName:
> value]]
>         output: self headDataModelView companyName
>         on: html.
>
> MLHeadDataModelView>>renderEmployeeTextInputOn:
> self
>         renderLabel: 'Employee Name: '
>         input: [
>             html textInput setFocus;

In Smalltalk the semantics of a cascade (indicated by the semi-colon)
means that the following #value: message is being sent to the receiver
of the last message. The last message is #setFocus, and the receiver
of the #setFocus was the object returned by the #textInput message.
Thus, #value: is being sent to a WATextInputTag (or similar object),
not to the WARenderCanvas (which is probably what you really wanted).

>             value: self headDataModelView employeeName;
>             callback: [:value | self headDataModelView employeeName:
> value]]
>         output: self headDataModelView employeeName
>         on: html.
>
> MLHeadDataModelView>>initialize
> initialize
>     super initialize.
>    self headDataModelView: MLHeadDataModel new.
>
> I don't get any error messages if I use the on:of: style, but not
> sure what exact difference or benefits are between the two.

The difference is that you don't have a #setFocus message.

> MLHeadDataModelView>>renderCompanyTextInputOn:
> renderCompanyTextInputOn: html
> self
>         renderLabel: 'Company Name: '
>         input: [
>             html textInput on: #companyName of: self
> headDataModelView]
>         output: self headDataModelView companyName
>         on: html.
>
> MLHeadDataModelView>>renderEmployeeTextInputOn:
> renderEmployeeTextInputOn: html
> self
>         renderLabel: 'Employee Name: '
>         input: [
>             html textInput on: #employeeName of: self
> headDataModelView]
>         output: self headDataModelView employeeName
>         on: html.
>
> Thanks in advance for any feedback.
>
> Regards
> Adrian

Hope that helps, and welcome to Seaside!

James Foster

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080830/febc0a74/attachment.htm

------------------------------

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


End of seaside Digest, Vol 68, Issue 38
***************************************


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