Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [text-list] faces

From: carl:cybercraft at: 13-May-2004 10:49

>Not a perfect solution, because as soon as you click a line, all lines are >redisplayed with the last color.
As I found out...
>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 > ;**** END > if iter/text: pick data id [ > lines: at data id > iter > ] > ] > ] >]
Yes - much better. Though if you're deciding on the color based on iter/text at that point, it gets it a line out. Moving it to the following if block gets it right though. ie... 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 if iter/text: pick data id [ ;**** EXTRA CODE iter/font/color: either iter/text = "bbb" [255.0.0][0.0.255] ;**** lines: at data id iter ] ] ] ] Thanks once again, -- Carl Read