[plt-scheme] format hierlist item text

From: Robert Bruce Findler (robby at cs.uchicago.edu)
Date: Tue Oct 15 13:10:48 EDT 2002

You need to get the editor of the item and then use the change-style
method with some pre-defined style-deltas. Here's an example:

(require (lib "hierlist.ss" "hierlist"))

(define f (make-object frame% "frame" #f 400 400))
(define hl (make-object hierarchical-list% f))
(define lst (send hl new-list))
(define lst-ed (send lst get-editor))

(define bold-sd (make-object style-delta% 'change-bold))
(define it-sd (make-object style-delta% 'change-italic))
(define green-sd (make-object style-delta%))
(send green-sd set-delta-foreground "forest green")

(send lst-ed insert "abcdefghijk")
(send lst-ed change-style it-sd 1 4)
(send lst-ed change-style bold-sd 3 6)
(send lst-ed change-style green-sd 5 8)

(send f show #t)

Hope that helps.

Robby


Posted on the users mailing list.