开发者

Missing method in mred:canvas%?

I used MrEd Designer to make a user interface for a Scheme program. It includes a mred:canvas% on which I'd like to plot points using draw-point. It's defined as:

(define (naca-ui-init
         {...}
         #:airfoil-canvas-class
         (airfoil-canvas-class canvas%)
         {...})

and later:

(set! airfoil-canvas
        (new
         airfoil-canvas-class
         (parent vertical-pane-2165)
         (horiz-margin 0)
         (min-width 350)
         (vert-margin 0)
         (gl-config #f)
         (stretchable-width #t)
         (enabled #t)
         (stretchable-height #t)
         (min-height 175)
         (label "Canvas")
         (style '(border))))

When I try to (send airfoil-canvas draw-point 15 30), however, I get:

send: no such method: draw-point for class: canvas%

 === context =开发者_如何转开发==
/usr/local/lib/racket/collects/racket/private/class-internal.rkt:4543:0: obj-error
/home/jason/NACA/naca-ui.scm:29:8: plot-point
/home/jason/NACA/naca.scm:225:23
/home/jason/NACA/naca-ui.scm:21:10: inner

Am I misreading the documentation, or is there something else I don't get here?

PS: Can someone with more rep add the tag MrEd? It would be pertinent here, but you need 1500 to add new tags.


Answering my own question: in short, my docs were moldy and I should have used http://docs.racket-lang.org/. From there, it was easy to see that:

(send airfoil-canvas draw-point 15 30)

should have been:

(send (send airfoil-canvas get-dc) draw-point 15 30)

You need to do your drawing on a drawing-context these days.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜