very basic listbox code request for comments

Timmy Douglas timmy+slate at cc.gatech.edu
Tue May 16 12:10:09 PDT 2006


Brian Rice <water at tunes.org> writes:

> On May 14, 2006, at 12:46 PM, Timmy Douglas wrote:
>
>> Brian Rice <water at tunes.org> writes:
>>
>>> That's the reason for "cascade" in the CSS acronym: so that separate
>>> stages of styling can be grouped and updated separately.
>>>
>>> How this is worked out on a technical level with a live-object
>>> environment is up to your imagination, and implies some overhead to
>>> track the styles and recompose, but this doesn't seem like a heavy
>>> price.
>>
>> it seems like #addDynamicSlot: could take care of this, except I'm not
>> sure if there is a way to "re-point" things back to the original
>> object after you call #addSlot: on one of the children (would just
>> removing it work?). I don't want to go ahead and write code when there
>> might already be a language feature to do it.
>
> There isn't a feature for that (removing an addDynamicSlot: override)  
> except to call #removeSlot: which would work, BUT that assumes that  
> you know on which object that override slot was made.

ok


>> But this part of it doesn't make sense root.slate (L525):
>>
>> x@(Root traits) addDynamicSlot: slotName valued: val
>> "This creates a `dynamic slot', which means an immutable delegated
>> slot
>> that can be overridden from its default per object, making an
>> effective
>> customization policy.
>> It works by ensuring that the object has a slot of that name with
>> that value,
>> and finally defining a mutator method on it to define a new slot on
>> the
>> *receiver* when mutations are attempted."
>> [
>>   x addImmutableSlot: slotName valued: val.
>>
>>
>> " why not addImmutableDelegate? "
>
> Do you want to delegate to the value 4 when you merely want it to be
> an overrideable default value? There's no case I can think of where
> you'd want to override a delegation dynamically using a mutator
> method.

Where did 4 come from? 


> Changing delegation dynamically is too powerful and should only be
> done when it's been thought through in a pattern (such as the
> Morphic dynamic mixins code).

I think this behavior sort of makes sense with users manually
overriding defaults in the themes here. Then, to change the default
color (etc) you just modify one value (in the top class), and since
the non-overriden objects all point to it, you don't have to do any
propagation down the line. To restore the default setting, you just
remove the slot in your object you overrode it in, and it points back
to the default.



>>   [| :obj :val | obj addSlot: slotName valued: val]
>>     asMethod: (x mutatorNameFor: slotName)
>>     on: {x. NoRole}.
>>   x
>> ].
>
>> When I tried copying and pasting that code and making the change in
>> theme.slate, then loading it, but I got weird errors later in ui.slate
>> where:
>
> Why did you have to load that code into Slate when you made no change  
> to it and it is already in the standard image?

I tried changing the 'slot' part to delegate..


> I need something more concrete that I can debug - a smaller, tighter
> test case.

this is my first time using darcs, I tried sending you a patch using
it. hopefully it works... here is what I'm doing here:


timmy at main ~/src/slate/slate/main $ ./vm -i slate.image 
Slate: Growing heap to 7790120 bytes.
Nil
Slate 1> ExternalMethod. 
lobby ensureNamespace: #Graphics &delegate: True. 
load: 'src/ui/region.slate'. 
load: 'src/ui/transform.slate'. 
load: 'src/ui/color.slate'. 
load: 'src/ui/colors.slate'. 
load: 'src/ui/event.slate'. 
load: 'src/lib/memoryarea.slate'. 
load: 'src/ui/form.slate'. 
load: 'src/lib/print.slate'.
load: 'src/ui/spacerequirement.slate'. 
load: 'src/ui/theme.slate'.
[(arity: 0)]
Slate 2> (traitsWindow)
Slate 3> Loading P'src/ui/region.slate'
Nil
Slate 4> Loading P'src/ui/transform.slate'
Nil
Slate 5> Loading P'src/ui/color.slate'
Nil
Slate 6> Loading P'src/ui/colors.slate'
Nil
Slate 7> Loading P'src/ui/event.slate'
 Loading P'src/lib/tree.slate'
Nil
Slate 8> Loading P'src/lib/memoryarea.slate'
Nil
Slate 9> Loading P'src/ui/form.slate'
 Loading P'src/lib/wordarray.slate'
Nil
Slate 10> Loading P'src/lib/print.slate'
Nil
Slate 11> Loading P'src/ui/spacerequirement.slate'
Nil
Slate 12> Loading P'src/ui/theme.slate'
Nil
Slate 13> lobby define: #ListboxElement &parents: {SelectionThemeElement. TextThemeElement}.
1.058791e-22
Slate 14> 



More information about the Slate mailing list