[plt-scheme] using inherit-field when making new gui widgets
At Thu, 4 Oct 2007 15:09:23 +0100, "Stephen De Gabrielle" wrote:
> timeline-selector.ss::158: class*: superclass does not provide field:
> min-width for class: timeline-selector%
> (note the character offset - rather than the line number/character position
> reported in bug 8954)
>
> I think I am using inherit field correctly, and the pane% I am using as a
> superclass does have a 'min-width' field.
The pane% class has a `min-width' method, not a field.
The pane% class also has a `min-width' initialization argument. But you
don't need to explicitly inherit it to use `min-width' with `super-new'
or `super-initialize'.
I think you want
(define timeline-selector% (class pane% ()
(init min-width)
; Make the drawing area
(super-new [min-width min-width]
....)
....
(define canvas (new canvas%
[parent this]
....
[min-width min-width]
....))
....))
or maybe
(define timeline-selector% (class pane% ()
(inherit min-width) ; inherit method
; Make the drawing area
(super-new ....)
....
(define canvas (new canvas%
[parent this]
....
;; call method to get arg:
[min-width (min-width)]
....))
....))
Matthew