mred:canvas% 中缺少方法?

发布于 2024-09-11 10:49:03 字数 1419 浏览 4 评论 0 原文

我使用MrEd Designer为Scheme程序制作用户界面。它包括一个 mred:canvas% ,我想在其上使用 draw-point 绘制点。它被定义为:

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

然后:

(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))))

当我尝试(sendairfoil-canvasdraw-point 15 30)时,但是,我得到:

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

我是否误读了文档,还是还有其他我不明白的内容?

PS:有更多代表的人可以添加标签 MrEd 吗?这在这里是相关的,但是您需要 1500 个才能添加新标签。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怼怹恏 2024-09-18 10:49:03

回答我自己的问题:简而言之,我的文档发霉了,我应该使用 http://docs.racket- lang.org/。从那里,很容易看出:

(send airfoil-canvas draw-point 15 30)

应该是:

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

这些天你需要在绘图上下文中进行绘图。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文