I'm having trouble with composite-classes in STklos. Below is a
session in STk and the code that's giving me trouble. I've simplified
the code down to the basic stuff that seems to cause the error: in the
full application, there is a need for the hierarchy I've chosen. If
anyone can help me fix this problem, I'd greatly appreciate the help.
Thanks alot
-jen mankoff
-jmankoff_at_cs.oberlin.edu
***************************** STk session ***********************
STk> (begin (require "Canvas") (define c (make <Canvas>)) (pack c))
<... munch ...>
STk> (define b (make <barplot> :parent c :coords '(1 2 3 4) :data '(foo) :numbars 3))
*** Error:
initialize-item: no method for #[<barplot> 100c2c34] subclass
Current eval stack:
__________________
0 (error "initialize-item: no method for ~S subclass" self)
1 (initialize-item self parent-id coords initargs)
2 (let ((cid (initialize-item self parent-id coords initargs))) (slot-set! self (quote cid) cid))
3 (initialize instance (append other-args (list :tk-options tk-options)))
4 (letrec ((instance (allocate-instance class initargs)) (valids (slot-ref class (quote tk-valid-options))) (tk-options ()) (other-args ())) (letrec ((|G2| (lambda (args) (if (null? args) (begin #[undefined]) (begin (let ((opt (tk::find-option (car args) valids))) (if opt (set! tk-options (list* (vector-ref opt 1) (cadr args) tk-options)) (set! other-args (list* (car args) (cadr args) other-args)))) (|G2| (cddr args))))))) (|G2| initargs)))
...
STk>
**************************** my code ****************************
;; data-store keeps data and other information
;; which can be be represented, among other ways,
;; as a barplot (see below)
(define-class <data-store> ()
((data ;; passed in
:init-keyword :data
:accessor data)))
(define-method initialize-item
((self <data-store>) args)
(slot-set! 'data (get-keyword :data args)))
;; barplot inherits from Tk (so it can draw in a canvas)
;; and from data-store (it's source of data & info about the data)
(define-class <barplot> (<Tk-composite-item> <data-store>)
((numbars
:accessor barspace)))
(define-method initialize-item
((self <barplot>) parent coords data args)
(let* ((parent (slot-ref self 'parent))
(numbars (get-keyword :numbars initargs 3))
(data (get-keyword :data initargs))
)
(slot-set! self 'numbars numbars)))
Received on Sat Jan 28 1995 - 05:33:37 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST