[REBOL] Re: [text-list] faces
From: didec:tiscali at: 12-May-2004 11:13
> Ah - finally! Never noticed text-pane before. (Which is most strange...) What I
was wanting to do was to have different colored lines of text. Can now...
> view layout [
> t: text-list "aaa" "bbb" "ccc"
> button "Change" [
> repeat line 3 [
> face: t/text-pane t/iter line
> insert face/text join line " "
> face/font/color: pick reduce [red green blue] line
> show face
Not a perfect solution, because as soon as you click a line, all lines are redisplayed
with the last color.
It can be done by changing the text-pane func itself to let it change the font color
or something else. Just take care of that : text-pane must return the iter face or none
view layout [
t: text-list "aaa" "bbb" "ccc" with [
text-pane: func [face id][
if pair? id [return 1 + second id / iter/size]
iter/offset: iter/old-offset: id - 1 * iter/size * 0x1
if iter/offset/y + iter/size/y > size/y [return none]
cnt: id: id + sn
;***** HERE IS THE ADDON : ALTERNATE COLOR EVEN/ODD
iter/font/color: pick [255.0.0 0.0.255] odd? id
if iter/text: pick data id [
lines: at data id
> Many thanks.
> -- Carl Read