self call: not working

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

self call: not working

John Thornborrow
Hi all,

I'm trying to use #call: but it's not working as expected.

renderContentOn: html
        | answer |
        answer := self call: (MyComponent new).
        "do other stuff with answer .."

Another (and simple) example:

renderContentOn: html
  self inform: 'foobar'

both render blank pages. Is this something I've configured incorrectly
somewhere, or is there a bug? (Originally occured with
Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)

I've created a new component and left everything in /config as default.

Regards,
John.


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: self call: not working

keith1y
John Thornborrow wrote:

> Hi all,
>
> I'm trying to use #call: but it's not working as expected.
>
> renderContentOn: html
> | answer |
> answer := self call: (MyComponent new).
> "do other stuff with answer .."
>
> Another (and simple) example:
>
> renderContentOn: html
>   self inform: 'foobar'
>
> both render blank pages. Is this something I've configured incorrectly
> somewhere, or is there a bug? (Originally occured with
> Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)
>  
Both of these are usually used as part of a callback, so as to respond
to a user action.

renderContentOn: html

    html anchor
       callback: [ answer := self call: (MyComponent new ];
       with: 'click me'.

best regards

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

Re: self call: not working

Randal L. Schwartz
In reply to this post by John Thornborrow
>>>>> "John" == John Thornborrow <[hidden email]> writes:

John> Hi all,
John> I'm trying to use #call: but it's not working as expected.

John> renderContentOn: html
John> | answer |
John> answer := self call: (MyComponent new).
John> "do other stuff with answer .."

John> Another (and simple) example:

John> renderContentOn: html
John>   self inform: 'foobar'

#call: replaces the current component with another, and should not
be used in render methods: only in callbacks.

If you want your top-level component to have no native rendering of its own,
just calling other components, you should be using a WATask and overriding #go
instead of overriding #renderContentOn: in a WAComponent.

See
http://methodsandmessages.vox.com/library/post/seaside-watask-vs-wacomponent.html
and
http://methodsandmessages.vox.com/library/post/a-few-bits-about-children-in-seaside.html
for details. (And yes, I'm moving some of this into the FAQ when I get back
from this trip!)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: self call: not working

John Thornborrow
In reply to this post by keith1y
Thanks, I suspected it was callback only, but is there not a way to use
#call: without requiring a user action?

Keith Hodges wrote:

> John Thornborrow wrote:
>> Hi all,
>>
>> I'm trying to use #call: but it's not working as expected.
>>
>> renderContentOn: html
>> | answer |
>> answer := self call: (MyComponent new).
>> "do other stuff with answer .."
>>
>> Another (and simple) example:
>>
>> renderContentOn: html
>>   self inform: 'foobar'
>>
>> both render blank pages. Is this something I've configured incorrectly
>> somewhere, or is there a bug? (Originally occured with
>> Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)
>>  
> Both of these are usually used as part of a callback, so as to respond
> to a user action.
>
> renderContentOn: html
>
>     html anchor
>        callback: [ answer := self call: (MyComponent new ];
>        with: 'click me'.
>
> best regards
>
> Keith
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

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

Re: self call: not working

Lukas Renggli
In reply to this post by keith1y
> > I'm trying to use #call: but it's not working as expected.

Sime, the Seaside code-critics framework, automatically detects that
kind of problems.

    http://source.lukas-renggli.ch/slime.html

Cheers,
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: self call: not working

Lukas Renggli
In reply to this post by John Thornborrow
> Thanks, I suspected it was callback only, but is there not a way to use
> #call: without requiring a user action?

Create a subclass of WATask and override #go.

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: self call: not working

John Thornborrow
In reply to this post by John Thornborrow
To answer myself, yes there is - WATask.

WATask>>go
  self isolate: [ answer := self call: MyComponent new ].
  self call: (MyComponent2 new answer: answer)

Regards,
John.

www.pinesoft.co.uk

John Thornborrow wrote:

> Thanks, I suspected it was callback only, but is there not a way to use
> #call: without requiring a user action?
>
> Keith Hodges wrote:
>> John Thornborrow wrote:
>>> Hi all,
>>>
>>> I'm trying to use #call: but it's not working as expected.
>>>
>>> renderContentOn: html
>>> | answer |
>>> answer := self call: (MyComponent new).
>>> "do other stuff with answer .."
>>>
>>> Another (and simple) example:
>>>
>>> renderContentOn: html
>>>   self inform: 'foobar'
>>>
>>> both render blank pages. Is this something I've configured incorrectly
>>> somewhere, or is there a bug? (Originally occured with
>>> Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)
>>>  
>> Both of these are usually used as part of a callback, so as to respond
>> to a user action.
>>
>> renderContentOn: html
>>
>>     html anchor
>>        callback: [ answer := self call: (MyComponent new ];
>>        with: 'click me'.
>>
>> best regards
>>
>> Keith
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
>
>
> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.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: self call: not working

John Thornborrow
I meant to say override WATask..

J.

John Thornborrow wrote:

> To answer myself, yes there is - WATask.
>
> WATask>>go
>   self isolate: [ answer := self call: MyComponent new ].
>   self call: (MyComponent2 new answer: answer)
>
> Regards,
> John.
>
> www.pinesoft.co.uk
>
> John Thornborrow wrote:
>> Thanks, I suspected it was callback only, but is there not a way to use
>> #call: without requiring a user action?
>>
>> Keith Hodges wrote:
>>> John Thornborrow wrote:
>>>> Hi all,
>>>>
>>>> I'm trying to use #call: but it's not working as expected.
>>>>
>>>> renderContentOn: html
>>>> | answer |
>>>> answer := self call: (MyComponent new).
>>>> "do other stuff with answer .."
>>>>
>>>> Another (and simple) example:
>>>>
>>>> renderContentOn: html
>>>>   self inform: 'foobar'
>>>>
>>>> both render blank pages. Is this something I've configured incorrectly
>>>> somewhere, or is there a bug? (Originally occured with
>>>> Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)
>>>>  
>>> Both of these are usually used as part of a callback, so as to respond
>>> to a user action.
>>>
>>> renderContentOn: html
>>>
>>>     html anchor
>>>        callback: [ answer := self call: (MyComponent new ];
>>>        with: 'click me'.
>>>
>>> best regards
>>>
>>> Keith
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>>
>>
>>
>> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.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
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: self call: not working

Sophie424
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message
> Sime, the Seaside code-critics framework, automatically detects that
> kind of problems.
>
>    http://source.lukas-renggli.ch/slime.html

This is great! 4 improvements in as many minutes! Could it be more visible
on Seaside?

Sophie



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

Re: self call: not working

John Thornborrow
In reply to this post by John Thornborrow
To follow this up... It doesn't quite work as I had hoped.

MyRootComponent>>renderContentOn: html
  html render: LoginTask new.

LoginTask>>go
  self isolate: [ answers := self call: LoginForm new ]
  model loginWith: (answers at: 1) password: (answers at: 2)

LoginForm>>renderContentOn: html
  html form with: [
    html textInput
      id: 'username';
      callback: [ :x | username := x ].
    html textInput
      id: 'password';
      callback: [ :x | password := x ].
    html submitButton callback: [ self answer: answer ]
  ]

Renders a blank page.. is there anything different I can do, so that it
will achieve this same goal?

Many thanks,
John

John Thornborrow wrote:

> I meant to say override WATask..
>
> J.
>
> John Thornborrow wrote:
>> To answer myself, yes there is - WATask.
>>
>> WATask>>go
>>   self isolate: [ answer := self call: MyComponent new ].
>>   self call: (MyComponent2 new answer: answer)
>>
>> Regards,
>> John.
>>
>> www.pinesoft.co.uk
>>
>> John Thornborrow wrote:
>>> Thanks, I suspected it was callback only, but is there not a way to use
>>> #call: without requiring a user action?
>>>
>>> Keith Hodges wrote:
>>>> John Thornborrow wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm trying to use #call: but it's not working as expected.
>>>>>
>>>>> renderContentOn: html
>>>>> | answer |
>>>>> answer := self call: (MyComponent new).
>>>>> "do other stuff with answer .."
>>>>>
>>>>> Another (and simple) example:
>>>>>
>>>>> renderContentOn: html
>>>>>   self inform: 'foobar'
>>>>>
>>>>> both render blank pages. Is this something I've configured incorrectly
>>>>> somewhere, or is there a bug? (Originally occured with
>>>>> Seaside-2.8a1-pmm.476, just tested with Seaside-2.8a1-tbn.539)
>>>>>  
>>>> Both of these are usually used as part of a callback, so as to respond
>>>> to a user action.
>>>>
>>>> renderContentOn: html
>>>>
>>>>     html anchor
>>>>        callback: [ answer := self call: (MyComponent new ];
>>>>        with: 'click me'.
>>>>
>>>> best regards
>>>>
>>>> Keith
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>>>
>>>
>>>
>>> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.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
>>
> _______________________________________________
> 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: self call: not working

Stefan Schmiedl
On Fri, 25 Jan 2008 17:25:13 +0000
John Thornborrow <[hidden email]> wrote:

> To follow this up... It doesn't quite work as I had hoped.

I'll try an answer here ... mind you, I'm no expert, you're
lucky if I know what I'm talking about :-)

>
> MyRootComponent>>renderContentOn: html
>   html render: LoginTask new.

Does render: execute LoginTask>>go ?

> LoginTask>>go
>   self isolate: [ answers := self call: LoginForm new ]
>   model loginWith: (answers at: 1) password: (answers at: 2)

the task is finished after the user has entered data once.
Where's the logic requiring a task for this linear flow?

How about

  LoginTask>>go
    [ self isolate: [ answers := self call: LoginForm new ] ]
      repeatUntil: [model loginWithAll: answers]

where loginWithAll: would return true if the authentication is
successful.

>
> LoginForm>>renderContentOn: html
>   html form with: [
>     html textInput
>       id: 'username';
>       callback: [ :x | username := x ].
>     html textInput
>       id: 'password';
>       callback: [ :x | password := x ].
>     html submitButton callback: [ self answer: answer ]
>   ]

Shouldn't that be [ self answer: (Array with: username with: password) ]
to fit the LoginTask?

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: self call: not working

Lukas Renggli
In reply to this post by Sophie424
> > Sime, the Seaside code-critics framework, automatically detects that
> > kind of problems.
> >
> >    http://source.lukas-renggli.ch/slime.html
>
> This is great! 4 improvements in as many minutes! Could it be more visible
> on Seaside?

Thanks. I think I mentioned it once in the mailing list. I also
blogged about it:

    http://www.lukas-renggli.ch/blog/slime

Again, if anybody has other Seaside related smells that would be
useful to detect, I would be glad to try to add them.

Cheers,
Lukas

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