Can a decorator be associated to many owners?

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

Can a decorator be associated to many owners?

Joseph Blatter
i want just one aWAMyDecorator to be the decorator for
various components. But AFAIK decorators are bound to
an owner.
so i was trying to attach a decorator (the same) to
two components, one of these components (a select tag,
the first one) has associated a live callback:

aMyComponentOne>>renderContentOn: html
 
     html select
            list: #(1 2 3 4 5);
            selected: 2;
            labels: [:ea | ea printString ];
            liveCallback: [:anIndex :h | self halt ].


aTestComponent>>renderContentOn: html
        aMyComponentOne addDecoration: aMyDecoration.
        html render: aMyComponentOne.

        aMyComponentTwo addDecoration: aMyDecoration.
        html render: aMyComponentTwo.

When i select an item i get an "Error: Components not
found while processing callbacks: aMyComponentOne"
error message.

however if i invert the calling order

aTestComponent>>renderContentOn: html

        aMyComponentTwo addDecoration: aMyDecoration.
        html render: aMyComponentTwo.

        aMyComponentOne addDecoration: aMyDecoration.
        html render: aMyComponentOne.

works fine, (?)

so isn't clear for me why decorators are related to
callback processing.

cheers



__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/ 
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Checkbox trouble with converting to canvas API

Carl Gundel
I'm converting my application over to the new canvas API.  It's going
reasonable well, but for some reason I cannot get the checkbox in the
example below to invoke its callback when the form is submitted.  I had no
trouble with this using the original API.  I've tried a bunch of things to
no avail.  Any ideas why this might not be working?

renderContentOn: html
    self hideCodeEditor ifTrue: [^self].
    (html div) id: #activeStuff;
        with:
            [html form with:
                [(html textArea) rows: 15; columns: 80; text: self code;
                    callback: [:v | self code: v].
                html tag: 'br'.
                (html anchor) text: 'Run';
                    callback: [self run]; submitFormNamed: #activeStuff.
                (html checkbox) value: self hideCodeEditor;
                    callback: [:v| self hideCodeEditor: v].
                html text: 'Hide code editor on Run']]

Thanks,

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com


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

Re: Checkbox trouble with converting to canvas API

Philippe Marschall
2006/10/27, Carl Gundel <[hidden email]>:

> I'm converting my application over to the new canvas API.  It's going
> reasonable well, but for some reason I cannot get the checkbox in the
> example below to invoke its callback when the form is submitted.  I had no
> trouble with this using the original API.  I've tried a bunch of things to
> no avail.  Any ideas why this might not be working?
>
> renderContentOn: html
>     self hideCodeEditor ifTrue: [^self].
>     (html div) id: #activeStuff;
>         with:
>             [html form with:
>                 [(html textArea) rows: 15; columns: 80; text: self code;
>                     callback: [:v | self code: v].
>                 html tag: 'br'.
>                 (html anchor) text: 'Run';
>                     callback: [self run]; submitFormNamed: #activeStuff.
>                 (html checkbox) value: self hideCodeEditor;
>                     callback: [:v| self hideCodeEditor: v].
>                 html text: 'Hide code editor on Run']]

Where to start?
- there is no form with id #activeStuff only a div
- #with: has always to be the last message, anchor #text: is an alias
for #with: so it has to be last message as well.
- forms should be submitted by submit buttons, that's what they are
there for. If You don't like their appearance, use CSS.
- you can make use of #on:of: for form elements.

Try something like this

renderContentOn: html
        html div
                id: #activeStuff;
                with: [
                html form: [
                        html textArea
                                rows: 15; columns: 80;
                                on: #code of: self.
                        html break.
                        html submitButton
                                callback: [ self run ];
                                text: 'Run'.
                        html checkbox
                                on: #hideCodeEditor of: self.
                        html text: 'Hide code editor on Run' ] ]

Forms are one of the suckiest parts of HTML. Seaside can't hide that.

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

Re: Checkbox trouble with converting to canvas API

Carl Gundel
From: "Philippe Marschall" <[hidden email]>

> 2006/10/27, Carl Gundel <[hidden email]>:
>> I'm converting my application over to the new canvas API.  It's going
>> reasonable well, but for some reason I cannot get the checkbox in the
>> example below to invoke its callback when the form is submitted.  I had
>> no
>> trouble with this using the original API.  I've tried a bunch of things
>> to
>> no avail.  Any ideas why this might not be working?
>
> Where to start?
> - there is no form with id #activeStuff only a div
> - #with: has always to be the last message, anchor #text: is an alias
> for #with: so it has to be last message as well.

That's kind of odd.  :-/

> - forms should be submitted by submit buttons, that's what they are
> there for. If You don't like their appearance, use CSS.

Sure. I intend to.  :-)

> - you can make use of #on:of: for form elements.

Thanks for the help.  It worked.

>Forms are one of the suckiest parts of HTML. Seaside can't hide that.

Perhaps not, but I did try to solve my problem by looking at other working
code and by reading other posts first.  Seaside is very cool and powerful,
but not quite obvious.  Better docs are needed.

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


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

Re: Checkbox trouble with converting to canvas API

Philippe Marschall
2006/10/29, Carl Gundel <[hidden email]>:

> From: "Philippe Marschall" <[hidden email]>
> > 2006/10/27, Carl Gundel <[hidden email]>:
> >> I'm converting my application over to the new canvas API.  It's going
> >> reasonable well, but for some reason I cannot get the checkbox in the
> >> example below to invoke its callback when the form is submitted.  I had
> >> no
> >> trouble with this using the original API.  I've tried a bunch of things
> >> to
> >> no avail.  Any ideas why this might not be working?
> >
> > Where to start?
> > - there is no form with id #activeStuff only a div
> > - #with: has always to be the last message, anchor #text: is an alias
> > for #with: so it has to be last message as well.
>
> That's kind of odd.  :-/

It's the same way like the element. First the attributes, then the content.

> > - forms should be submitted by submit buttons, that's what they are
> > there for. If You don't like their appearance, use CSS.
>
> Sure. I intend to.  :-)
>
> > - you can make use of #on:of: for form elements.
>
> Thanks for the help.  It worked.
>
> >Forms are one of the suckiest parts of HTML. Seaside can't hide that.
>
> Perhaps not, but I did try to solve my problem by looking at other working
> code and by reading other posts first.  Seaside is very cool and powerful,
> but not quite obvious.  Better docs are needed.

Yepp

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

Re: Checkbox trouble with converting to canvas API

Philippe Marschall
In reply to this post by Carl Gundel
2006/10/29, Carl Gundel <[hidden email]>:

> From: "Philippe Marschall" <[hidden email]>
> > 2006/10/27, Carl Gundel <[hidden email]>:
> >> I'm converting my application over to the new canvas API.  It's going
> >> reasonable well, but for some reason I cannot get the checkbox in the
> >> example below to invoke its callback when the form is submitted.  I had
> >> no
> >> trouble with this using the original API.  I've tried a bunch of things
> >> to
> >> no avail.  Any ideas why this might not be working?
> >
> > Where to start?
> > - there is no form with id #activeStuff only a div
> > - #with: has always to be the last message, anchor #text: is an alias
> > for #with: so it has to be last message as well.
>
> That's kind of odd.  :-/
>
> > - forms should be submitted by submit buttons, that's what they are
> > there for. If You don't like their appearance, use CSS.
>
> Sure. I intend to.  :-)
>
> > - you can make use of #on:of: for form elements.
>
> Thanks for the help.  It worked.
>
> >Forms are one of the suckiest parts of HTML. Seaside can't hide that.
>
> Perhaps not, but I did try to solve my problem by looking at other working
> code and by reading other posts first.  Seaside is very cool and powerful,
> but not quite obvious.  Better docs are needed.
I'm happy to report that your problem as well as the one of Sébastien
Rocca-Serra are now covered by the SeasideFAQ found in the Seaside
repository.

Cheers
Philippe

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

Re: Checkbox trouble with converting to canvas API

Carl Gundel
----- Original Message -----
From: "Philippe Marschall" <[hidden email]>
> I'm happy to report that your problem as well as the one of Sébastien
> Rocca-Serra are now covered by the SeasideFAQ found in the Seaside
> repository.

Thanks.  Do you have a link for that?  :-)

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


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

Re: Checkbox trouble with converting to canvas API

Philippe Marschall
2006/10/31, Carl Gundel <[hidden email]>:
> ----- Original Message -----
> From: "Philippe Marschall" <[hidden email]>
> > I'm happy to report that your problem as well as the one of Sébastien
> > Rocca-Serra are now covered by the SeasideFAQ found in the Seaside
> > repository.
>
> Thanks.  Do you have a link for that?  :-)

It's a Seaside application itself that can be found in the Seaside repository:
http://squeaksource.com/Seaside/

Cheers
Philippe

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