[racket] Invisible Canvas question

From: Eduardo Bellani (ebellani at gmail.com)
Date: Thu Mar 31 16:29:14 EDT 2011

Could someone please explain why there is an invisible canvas in this
example?

Env:
Linux 2.6.31-23-generic Ubuntu i686 GNU/Linux
racket 5.1.0.4

#lang racket

(require racket/gui)

(define bitmap-canvas%
  (class canvas%
    (init-field [bitmap #f])
    (inherit get-dc)
    (define/override (on-paint)
      (send (get-dc) draw-bitmap bitmap 0 0))
    (super-new)))


(define bitmap (read-bitmap "data/image_0.jpg"))

(define f (new frame% [label "foo"] [width 100] [height 100]))
(define p (new panel% [parent f]))
(define p2 (new vertical-panel% [parent f]))

;; why is this invisible?
(define invisible-canvas (new bitmap-canvas%
                              [parent p]
                              [bitmap bitmap]))
(define visible-canvas (new bitmap-canvas%
                            [parent p2]
                            [bitmap bitmap]))

(send f show #t)




-- 
Eduardo Bellani

omnia mutantur, nihil interit.


Posted on the users mailing list.