racket - Typed Racket 扩展 gui 类
问题描述
我想扩展课程 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)
))
你可能会说我对球拍很陌生,而且我还在学习。
解决方案
我很确定该错误消息的含义是您需要“初始化”该类中的所有内容。
一种有用的方法是在您的类型定义中更改 from#:implements
并#:implements/inits
在缺少的值上调用 init (在这种情况下stretchable-height
)。
如果你不知道它们到底是什么,你可以简单地把(init-rest)
它放在一边。
推荐阅读
- c# - 如何在 LinqPad6 中定义环境和常量?
- selenium - 硒流 - NoSuchElementException
- vue.js - Vue.js 3 - 替换/更新反应性对象而不会失去反应性
- arrays - 程序无法在 C 中打印整个字符串数组,但它要么什么都不打印,要么只打印第一个字符。怎么了?
- javascript - Jquery append with Laravel:没有第一个开始就无法结束一个部分
- react-native - 无法使用 react-native-tcp-socket 接收来自服务器的响应
- masstransit - 使用 MassTransit 发送当前委托人
- assembly - 数字的二进制补码表示
- python - 对带有 USB 全速半双工通话优先级的 PySerial 感到困惑
- spring-boot - 使用基于 SEQUENCE 的自定义 ID 生成器时如何获取当前保存的 ID?