Am Mittwoch, 3. Dezember 2003 06:27 schrieb [EMAIL PROTECTED]: > Hi all, > > I have a problem with list & text-list vid objects. > > If I set up a list with a particular font style all subsequent text-list > seem to use the same font object ... see example the code below. > > I dont want to specify a particular font style in my text-list .... (as in > the real application there are many possible text-list's) > > Changing > text 100 > to > text font [] 1000 > seems to fix the problem in this particular example but in my real world > application, which has multiple columns in the list, is doesnt seem to fix > the problem. > > Any ideas? ... or perhaps an explanation of how to force a seperate font > object for the list object? >
Reason: /font and /para are stored in sub-objects. and this objects are shared with the base-style. So changing the sub-object affect every face using that font. Not only next text-lists, but everything using 'text. Solution: You have to clone the font-object for each face where you change it. You can trigger that with layout[text font[] para[]]. This syntax is because the [] contains an object-spec. So you can say [text font[style: 'bold]] and have a unique bold font in your face. view layout[ across text "Hello" font[style: 'bold] text "World" font[style: 'italic] ] Experiments: Writing [font[]] everywhere is annoying. So i tried using styles. (change in your text-list) ;style tx text 100 font[] ;all 'tx share the same font style tx text 100 with[append init [font: make font[]]] ; ^ each tx own font across a: tx b: tx I checked for cloning with [ probe same? a/font b/font ] With the first version: style tx text 100 font[] the style 'tx gets its own font. then all 'tx share this font. that saves some font-objects. Second version: style tx text 100 with[append init [font: make font[]]] this makes sure each face gets its own font. the [append init[]] is the rebol way of a constructor. layout does it after it has filled the face from the arguments. So font and size etc are already calculated. Hint: when cloning objects, sub-objects stay shared, series (blocks, strings), functions are copied. So the 'init -block is unique for each face, and we can simply append. Your example changed: rebol [] data1: ["Hello" "world" "here" "are" "some" "lines" "in" "a" "list"] data2: ["This" "is" "a" "normal" "text" "list"] lv-lay: layout [ my-list: list 400x200 with [picked: false] [ ;style tx text 100 font[] ;all 'tx share the same font style tx text 100 with[append init [font: make font[]]] ; ^ each tx own font across a: tx b: tx ] supply [ if count > length? data1 [face/show?: false exit] face/show?: true ; print [count index] ;print [count index pick data1 count] face/text: pick data1 count face/font/style: 'bold ] button "Show Text List" [ view/new layout [text-list data data2] probe same? a/font b/font ] ] view lv-lay quit > Cheers Phil > > 8< --------------------------- > HTH -Volker -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.