Re: using tkwait with tk-objects

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Tue, 19 Jul 1994 12:22:52 +0100

>........
> For such a simple demo i don't want to use the global variable so i
> started to write
>
> (define (test2)
> (define t (make <TopLevel>))
> (define b (make <Button> :text "Cancel" :parent t
> :command `(destroy ,(address-of t))))
> (pack b)
>
> ;(tkwait 'window t)
> )
>
> but converting t back to it's tk-name has me stumped. Is there such a
> mechanism? Maybe this is the wrong way to go? Anyone have any ideas?

You have to use the Eid fucntion which gives you the (Tk) name of the window
So the previous tkwait must be written

        (tkwait 'window (Eid t))

In fact a better solution consist to write a general tkwait function which
accepts both objects and Tk id. This function could be writtens as

        ;;;; a general tkwait
        (define (tkwait mode window)
          (Tk:tkwait mode
                     (if (instance? window) (slot-ref window 'Eid) window)))

I have forgotten to put it in the Basics.stk file in the distribution. This is
done now and next release will have it.

                -- Erick
Received on Tue Jul 19 1994 - 12:22:53 CEST

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