[plt-scheme] Background image in a MrEd frame

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Dec 13 12:49:18 EST 2005

At Wed, 07 Dec 2005 13:31:40 -0500, David Belle-Isle wrote:
> I still have some problems displaying my background though.
> 
> Here is the part of code I use to create the background region
> 
> 
> 
> (send table add-region (make-background-region 0
>                                                0
>                                                934
>                                                683
>                                                (lambda(dc-object x y w h)
>                                                  (send dc-object draw-bitmap
> (make-object bitmap% "bg.bmp") x y 'solid))
>                                                ))

I wonder whether "bg.bmp" isn't found because the current directory
isn't the one that has "bg.bmp". What if you use an absolute path?

Here's an example that works for me:

 (require (lib "cards.ss" "games" "cards"))

 (define table (make-table "Hello" 5 5))

 (define bm (make-object bitmap%
              (build-path (collection-path "icons")
                          "PLT-206.png")))

 (send table add-region 
       (make-background-region 
        0
        0
        934
        683
        (lambda(dc-object x y w h)
          (send dc-object draw-bitmap bm x y 'solid))))

 (send table show #t)


Matthew



Posted on the users mailing list.