Hi, I'm having a go at creating a new widget<br><br>But I am getting the error<br><br>timeline-selector.ss::158: class*: superclass does not provide field: min-width for class: timeline-selector%<br>(note the character offset - rather than the line number/character position reported in bug 8954)
<br clear="all"><br>I think I am using inherit field correctly, and the pane% I am using as a superclass does have a 'min-width' field. <br><br>As I understand the manual, I need inherit field so I can access the field in my subclass (in this case to make a canvas).
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">An inherit-field declaration makes a public field defined by a superclass directly accessible in the class expression. If the indicated field is not defined in the superclass, the exn:fail:object exception is raised when the class expression is evaluated. Every field in a superclass is present in a derived class, even if it is not declared with inherit-field in the derived class. The inherit-field clause does not control inheritance, but merely controls lexical scope within a class expression.
<br></blockquote><br>Can anyone let me know where I have gone wrong?<br><br>This is how I call the creation of my new class<br><br> (define timeline-selector (new timeline-selector% (parent the-horizontal-pane) <br> (min-width 100) (min-height 800)
<br> (stretchable-width #f) (stretchable-height #f)))<br><br><br>; make new widget<br> <br> (define timeline-selector% (class pane% ()<br> (inherit-field min-width
<br> stretchable-width<br> min-height<br> stretchable-height )<br> (init-field parent )
<br> ; Make the drawing area<br> (super-instantiate () (parent parent)) ; instantiate this FIRST<br> ;; [min-width min-width] [stretchable-width stretchable-width] ;; commented out as hopefully not needed
<br> ;; (min-height min-height) [stretchable-height stretchable-height]) <br> <br> ;; internal data<br> (define list-of-points '()) ;; start with empty list
<br> (define canvas (new canvas% [parent this] <br> (style '(control-border))<br> (paint-callback (lambda (canvas dc) (draw-chart)))
<br> [min-width min-width] [stretchable-width #f]<br> [min-height min-height] [stretchable-height #f]<br> ))
<br> (define/public (get-dc) (send canvas get-dc)) ; Get the canvas's drawing context<br>(... and so on)<br><br>Cheers,<br><br>Stephen<br><br><br><br>--<br>Stephen De Gabrielle<br><a href="mailto:s.degabrielle@ucl.ac.uk">
s.degabrielle@ucl.ac.uk</a><br>Telephone +44 (0)20 7679 5242 (x45242)<br>Mobile 079 851 890 45<br><a href="http://www.uclic.ucl.ac.uk/annb/MaSI.html">http://www.uclic.ucl.ac.uk/annb/MaSI.html</a><br>University College London Interaction Centre
<br>Remax House - 31/32 Alfred Place<br>London - WC1E 7DP