类型的球拍扩展GUI类

时间:2020-09-22 21:03:38

标签: racket typed-racket

我想扩展类horizontal-panel%,但不知何故我收到了此错误消息:

class has init `stretchable-height' that is not in expected type in: (class horizontal-panel% (super-new))

到目前为止,这是我的代码:

#lang typed/racket
(require typed/racket/gui)

(define-type Graph-Tab%
  (Class #:implements  Horizontal-Panel%

         ))
(: graph-tab% : Graph-Tab%)
(define graph-tab%
  (class horizontal-panel%
    (super-new)

    ))

您可能会说我对球拍很陌生,但我仍在学习。

1 个答案:

答案 0 :(得分:0)

我很确定该错误消息的意思是您需要“初始化”该类中的所有内容。

执行此操作的一种有用方法是在类型定义中将#:implements更改为#:implements/inits,然后对缺少的值(在本例中为stretchable-height)进行初始化。 / p>

如果您不确切知道它们是什么,可以简单地输入(init-rest)并加以注意。

(这是Initialization Variablesalso for horizontal-panel%的文档)

相关问题