callback wierdness

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

callback wierdness

keith1y
I have a component, whose renderContentOn: code includes an exception handler.
Within that exception handler I render an anchor with a callback. When viewing
the component, the display shows the result of the anchor's callback handler
even though I havnet clicked on the anchor yet.

???

Keith

---------------
code follows:

----------------
MagmaStatus>>renderContentOn: html

    html heading: 'Magma Status'.
    self location isLocal ifTrue: [ self renderLocalPathOn: html ]
                         ifFalse: [ self renderRemoteHostOn: html ].

self magmaConnect: [
    self ifLocal: [ html anchor callback: [ self deleteRepository ]; text: '(delete repository)' ].

    html bold: 'Cached Object Count: '.

    html text: self magmaSession cachedObjectCount

] ifAbsent: [ :ex |

    html break.

    html bold: 'Error: ', ex messageText.

    self ifLocal: [

        html break.    

        html anchor callback: [ self createRepository ]; text: '(create repository)'.

        html break.

    ].

================
WAMagmaStatus>createRepository

Warning signal: 'here'





               
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback wierdness

keith1y
For some reason, I start here with the WACOnfigurationEditor rendering
where html  is WARenderCanvas.

html anchor callback: [ self call: (WAMagmaStatus new setLocation:
location) ]; text: '(magma control panel)'.

and when I arrive in the code that I previously posted html is
WAHtmlRenderer, i.e. the api has switched on me.

any ideas what is going wrong?

many thanks in advance

Keith


               
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback wierdness

Richard Huxton
Keith Hodges wrote:

> For some reason, I start here with the WACOnfigurationEditor rendering
> where html  is WARenderCanvas.
>
> html anchor callback: [ self call: (WAMagmaStatus new setLocation:
> location) ]; text: '(magma control panel)'.
>
> and when I arrive in the code that I previously posted html is
> WAHtmlRenderer, i.e. the api has switched on me.
>
> any ideas what is going wrong?

Is there a #rendererClass method overriding it?

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

Re: callback wierdness

keith1y
Richard Huxton wrote:

> Keith Hodges wrote:
>> For some reason, I start here with the WACOnfigurationEditor
>> rendering where html  is WARenderCanvas.
>>
>> html anchor callback: [ self call: (WAMagmaStatus new setLocation:
>> location) ]; text: '(magma control panel)'.
>>
>> and when I arrive in the code that I previously posted html is
>> WAHtmlRenderer, i.e. the api has switched on me.
>>
>> any ideas what is going wrong?
>
> Is there a #rendererClass method overriding it?
>

BasicAuthentication renderClass (inherited from WAPresenter) appears to
be set to WAHtmlRenderer.

does this mean that I shouldnt be using call: at all within the canvas api?

Keith



               
___________________________________________________________
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback wierdness

Richard Huxton
Keith Hodges wrote:

> Richard Huxton wrote:
>> Keith Hodges wrote:
>>> For some reason, I start here with the WACOnfigurationEditor
>>> rendering where html  is WARenderCanvas.
>>>
>>> html anchor callback: [ self call: (WAMagmaStatus new setLocation:
>>> location) ]; text: '(magma control panel)'.
>>>
>>> and when I arrive in the code that I previously posted html is
>>> WAHtmlRenderer, i.e. the api has switched on me.
>>>
>>> any ideas what is going wrong?
>>
>> Is there a #rendererClass method overriding it?
>>
>
> BasicAuthentication renderClass (inherited from WAPresenter) appears to
> be set to WAHtmlRenderer.
>
> does this mean that I shouldnt be using call: at all within the canvas api?

Can't see why. I'm not sure I understand what the problem is.

In your inital email you said something was being displayed before you
had clicked on a link. What is being displayed, and what link? From your
initial email I couldn't see what "the result of the anchor's callback
handler" meant.

Oh, you might find it useful to add a "self debug" near the code you
think shouldn't be executed?
--
   Richard Huxton
   Archonet Ltd
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback wierdness

keith1y
I wrote something like this

html anchor callback: [ html text: 'hello' ] text: 'world'.

and the output was

'helloworld'

i.e. the result of the callback was being rendered before I had clicked
on the anchor.

It turns out that in WAConfiguration editor is renderered on
WARenderCanvas, when I do

html anchor callback: [ self call: WAMyComponent new ] text: 'clickme'.

and I click on the anchor, the resulting

WAMyComponent's rendering is on WAHtmlRenderer.

and this is giving the above behaviour. I would much rather that call:
wired my component to render using WARenderCanvas but this setting seams
to be picked up from WAPresenter in the guts of the inner workings of
call: , hence my question should I be using call: or has it been
replaced with an alternative?

Keith

               
___________________________________________________________
Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: callback wierdness

Richard Huxton
Keith Hodges wrote:

> I wrote something like this
>
> html anchor callback: [ html text: 'hello' ] text: 'world'.
>
> and the output was
>
> 'helloworld'
>
> i.e. the result of the callback was being rendered before I had clicked
> on the anchor.

This will not work, because you are asking the callback to render
outside of the rendering phase. What you want is something like:

initialize
        ...
        myStatus := 'hello'

renderContentOn: html
        html anchor callback: [ myStatus := 'goodbye' ] text: ' world'.

Then, the callback will set the status and in the render cycle you will
receive a "renderContentOn" message on your component again. I made this
same mistake at the start.

> It turns out that in WAConfiguration editor is renderered on
> WARenderCanvas, when I do
>
> html anchor callback: [ self call: WAMyComponent new ] text: 'clickme'.
>
> and I click on the anchor, the resulting
>
> WAMyComponent's rendering is on WAHtmlRenderer.
>
> and this is giving the above behaviour. I would much rather that call:
> wired my component to render using WARenderCanvas

Your component needs to choose how it renders itself. By setting its
rendererClass method. Or, you have one default for all your components,
by setting it in a superclass. So, you should add
        rendererClass
                ^'WARenderCanvas'
to WAMyComponent.

 > but this setting seams
> to be picked up from WAPresenter in the guts of the inner workings of
> call: , hence my question should I be using call: or has it been
> replaced with an alternative?

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

Re: callback wierdness

keith1y

>
> Your component needs to choose how it renders itself. By setting its
> rendererClass method. Or, you have one default for all your
> components, by setting it in a superclass. So, you should add
>     rendererClass
>         ^'WARenderCanvas'
>
bingo,

thanks for that

Keith


               
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside