Question about bindings & STklos objects

From: Harvey J. Stein <>
Date: Thu, 17 Nov 1994 09:04:51 +0200

I have a problem I've run into several times & have been unable to
find a clean solution to. The problem is get a binding to know the
object to which it applies.

For example, suppose I have an object R of class <flash-box> on a
canvas C. <flash-box> is just a subclass of <Rectangle> which is
supposed to flash when it is clicked on. So, I have a method defined

(define-method flash ((r <flash-box>))

To give <flash-box> the proper behaviour, I want to, when I
instantiate a <flash-box>, bind <Button-1> to the flash method. So,
in the initialize function for <flash-box> I'd have a line like:

   (bind r "<Button-3>" `(flash ',r))

However, this doesn't work, presumably because when `(flash ',r) is
evaluated and passed to bind, it becomes something like
(flash (quote #[<flash-box> ff638])). As code this is ok (e.g. - if I
set the variable x by doing (define x `(flash ',r)), the box will flash
when I (eval x). However, when it's passed to Tk it becomes a string.
When Tk tries to evaluate it, it gets passed (as a string) back to the
scheme interpreter, which can't convert #[...] back to anything, so the
reader gives an error.

So, does anyone have a way around this?


Dr. Harvey J. Stein
Berger Financial Research
Received on Thu Nov 17 1994 - 08:06:35 CET

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