Creating a new class

From: Kevin K. Lewis <lewikk_at_rockdal.aud.alcatel.com>
Date: Fri, 9 Feb 96 15:22:08 CST

Hi, folks.

I'm very new to STk, so this may be pretty basic; but I didn't see any
examples that did this.

I'm trying to create a new class that is basically a rectangle which
has a label. I thought that I'd inherit from <Rectangle> and have a
label slot.

Here's what I have:

---
[...]
(define frame (make <Frame>))
(define canvas (make <Canvas> :parent frame
                     :relief "groove"
                     :width 800 :height 600))
(define-class <BON-object> (<Rectangle>)
  ((label :init-keyword :label :accessor label)))
(define bon-object (make <BON-object> :parent canvas
                         :label (make <Label> :parent canvas
                                      :text "BON-object")
                         :tags "BON-object"
                         :fill "Red"
                         :coords '(100 100 200 150)))
[...]
---
My question is, how do I get the label to show up?  Right now, I just
get a red rectangle.  Also, is this even the best way to define my
class?
Thanks for any help or advice.
-- 
Kevin K. Lewis               | My opinions may be unreasonable
lewikk_at_aud.alcatel.com       | but such is the voice of inspiration
Received on Fri Feb 09 1996 - 22:24:17 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST