[plt-scheme] cue-text%

From: Jens Axel Soegaard (jensaxel at soegaard.net)
Date: Sat Apr 4 17:15:38 EDT 2009

A cue-text:

   Gives a text% an instantiation argument of a string that is displayed
   in the text% initially in grey; the text disappears when the text gets
   focus. This technique is useful for labeling texts without needing to
   take up space.

If I put the cue-text into an editor-snip%, the cue is not cleared.
Is this a bug, or is this to be expected?

#lang scheme/gui
(require embedded-gui framework)
(new editor-snip%
        [editor (new cue-text% (cue-text "Hello World"))])

Note, that if the cue-text is displayed in its own frame, then
the cue is cleared:

#lang scheme/gui
(require embedded-gui framework)

(define f (new frame% (label "f") (width 400) (height 400)))
(define e (new text%))
(define c (new editor-canvas% (editor e) (parent f)))
(define t (new cue-text% (cue-text "Hello, World!")))
(define s (new editor-snip% (editor t)))
(send e insert s)
(send f show #t)

Jens Axel Søgaard

Posted on the users mailing list.