Re: Is it possible to do this

From: Erick Gallesio <eg_at_unice.fr>
Date: Sun, 9 Jul 2000 16:06:30 +0200 (CEST)

Evrard Nicolas writes:
> Hello, schemers ...
>
> I've make a canvas in which i put a circle and a letter and i 'd like to
> move them together i've tried putting them in a window but it doesn't
> seem to work how should i do this ... ?

Yes you can do that by giving the same tag to both objects. In the
following example, I use the bind-for-drag convenience fucntion to do
the job (see end of file Canvas.stk for complete details)


(require "Tk-classes")

(define x (make <Canvas>))
(pack x)

(define c (make <Oval> :coords '(10 10 110 110) :parent x :fill "yellow"
                :tags "tag" ))
(define l (make <Text-item> :coords '(55 55) :parent x :text "Test" :tags "tag"))

(bind-for-dragging x :button 1 :tag "tag" :only-current #f)


The thing which is important here is that both c an d l share the same
tage which is just the string "tag" in this case.

Hope it helps.

   
                -- Erick
Received on Sun Jul 09 2000 - 16:04:58 CEST

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