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

Rick Flower rickf at ca-flower.com
Fri Apr 6 22:37:14 UTC 2007

Philippe Marschall wrote:

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

oohh.. Aaahhh.. That's what I'm looking for then.. With that, I should 
no longer need to fiddle with my array read from the Glorpilicious 
database.. Very good indeed.. It wasn't clear (to me -- a relative ST 
newbie) what the code in #optionsOn: was doing.. But in reviewing the 
code again, I see uses of a brush and optionalLabel.. I'll give it a 
whirl to see if it works as I expect..

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

Yeah, I saw that code already which is why I asked if there was any 
obvious benefit -- it sounds like it's just shorter based on your 
comment.  I'll give it a try as well.. Shorter code = easier to read 
code -- at least most of the time. (8->

More information about the Seaside mailing list