#children problems

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

#children problems

Joseph Blatter

Can I configure callbacks in a subcomponent of a page
(component) without sending #children?

My problem is that I have a page with too many
subcomponents (controls like ListBox's, TextField's,
etc) and I've seen in order to set a callback I must
implement #children in the page (component) answering
these controls already created. I don't see another
solution to this problem other than adding all the
controls as instance variables which is a solution not
elegant/convenient/feasible for me.

Another issue with this is in the #renderContentOn:
I'm creating a component with a custom style but when
I've tried to set a property like

aTextField := MyWAComponent new.
aTextField width: 30. "#width: creates the CSS code"

nothing happens.
Any tips or ideas?



__________________________________________________
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
|

Re: #children problems

Yanni Chiu
Joseph Blatter wrote:
> ... I don't see another
> solution to this problem other than adding all the
> controls as instance variables which is a solution not
> elegant/convenient/feasible for me.

I sometimes use a dictionary, e.g.:

initialize
     children := IdentityDictionary

children
     ^children values

renderXYZ
     ...
     children at: #part1 put: MyPart new

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

Re: #children problems

Avi  Bryant
In reply to this post by Joseph Blatter

On Oct 18, 2006, at 8:43 AM, Joseph Blatter wrote:

>
> Can I configure callbacks in a subcomponent of a page
> (component) without sending #children?
>
> My problem is that I have a page with too many
> subcomponents (controls like ListBox's, TextField's,
> etc) and I've seen in order to set a callback I must
> implement #children in the page (component) answering
> these controls already created. I don't see another
> solution to this problem other than adding all the
> controls as instance variables which is a solution not
> elegant/convenient/feasible for me.

Are you sure they need to be components?  Anything can implement  
#renderOn:, but only subclasses of WAComponent need to appear in  
#children.  If you don't need the various methods and hooks  
WAComponent provides (like #call:, #updateRoot:, #updateUrl:), then  
your controls can be simple subclasses of Object instead.

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

Re: #children problems

Joseph Blatter
I'd need my controls to be components because I want
to attach a custom css style to each control. I've
tested your suggestion but I've seen the renderer take
the style from the childrens
(WARenderer>>buildDocRoot), making impossible to get
my custom styles ever called.

So it's still possible to get the #style called being
a control not a children of the page?
thanks


 --- Avi Bryant <[hidden email]> escribió:

>
> On Oct 18, 2006, at 8:43 AM, Joseph Blatter wrote:
>
> >
> > Can I configure callbacks in a subcomponent of a
> page
> > (component) without sending #children?
> >
> > My problem is that I have a page with too many
> > subcomponents (controls like ListBox's,
> TextField's,
> > etc) and I've seen in order to set a callback I
> must
> > implement #children in the page (component)
> answering
> > these controls already created. I don't see
> another
> > solution to this problem other than adding all the
> > controls as instance variables which is a solution
> not
> > elegant/convenient/feasible for me.
>
> Are you sure they need to be components?  Anything
> can implement  
> #renderOn:, but only subclasses of WAComponent need
> to appear in  
> #children.  If you don't need the various methods
> and hooks  
> WAComponent provides (like #call:, #updateRoot:,
> #updateUrl:), then  
> your controls can be simple subclasses of Object
> instead.
>
> Avi
> _______________________________________________
> Seaside mailing list
> [hidden email]
>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


__________________________________________________
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
|

Re: #children problems

Avi  Bryant

On Oct 18, 2006, at 12:45 PM, Joseph Blatter wrote:

> I'd need my controls to be components because I want
> to attach a custom css style to each control. I've
> tested your suggestion but I've seen the renderer take
> the style from the childrens
> (WARenderer>>buildDocRoot), making impossible to get
> my custom styles ever called.
>
> So it's still possible to get the #style called being
> a control not a children of the page?

I'd recommend against doing anything dynamic with CSS.  In fact, I'd  
recommend against using #style at all.  Instead, set up a static  
stylesheet somewhere that has a CSS class for each possibility, and  
dynamically assign the right class to your controls.  If you really  
need to do something like compute a width, use a style attribute  
(html div style: 'width: 100px'; ...).

Does that help?

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

Re: #children problems

Joseph Blatter
I'll try your suggestion, thanks.


 --- Avi Bryant <[hidden email]> escribió:

>
> On Oct 18, 2006, at 12:45 PM, Joseph Blatter wrote:
>
> > I'd need my controls to be components because I
> want
> > to attach a custom css style to each control. I've
> > tested your suggestion but I've seen the renderer
> take
> > the style from the childrens
> > (WARenderer>>buildDocRoot), making impossible to
> get
> > my custom styles ever called.
> >
> > So it's still possible to get the #style called
> being
> > a control not a children of the page?
>
> I'd recommend against doing anything dynamic with
> CSS.  In fact, I'd  
> recommend against using #style at all.  Instead, set
> up a static  
> stylesheet somewhere that has a CSS class for each
> possibility, and  
> dynamically assign the right class to your controls.
>  If you really  
> need to do something like compute a width, use a
> style attribute  
> (html div style: 'width: 100px'; ...).
>
> Does that help?
>
> Avi
> _______________________________________________
> Seaside mailing list
> [hidden email]
>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


__________________________________________________
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