[Seaside] Usage of Canvas' #select and #labels

Philippe Marschall philippe.marschall at gmail.com
Fri Apr 6 22:19:46 UTC 2007


2007/4/6, Rick Flower <rickf at ca-flower.com>:
> Philippe Marschall wrote:
>
> > html select
> >    beOptional
> >    list: orgs;
> >    on: #orgId of: self;
> >     "You can use #name if you implement #value in Symbol
> >     You can leave this out of you implement #displayString or
> > #renderOn. in your domain class"
> >    labels: [:org | org name ];
> >    optionalLabel: 'Select One...'.
>
>
> Hmm.. I saw the "beOptional" but wasn't sure what it did -- is that just
> a flag that controls whether or not to use the optionalLabel or does it
> do something else as well? I did miss however the #optionalLabel:
> method.

#beOptional adds a nil item to #list which has the semantic of no
selection. #optionalLabel: is the label for nil.

> I'm not really sure what the #on: is doing -- it looks like an
> alternative to #callback -- any comments on why its better?  Is that
> because I'm not specifying a #selected call and this one call does both?

It's not "better" it just saves the the #selected and #callback:

You probably don't want to hear it but one of the many copy pasted
(noone needs Traits in real applications anyway) should explain it:

on: selector of: anObject
	self value: (anObject perform: selector).
	self callback: [ :value | anObject perform: selector asMutator with: value ]

Philippe

> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the Seaside mailing list