Erick Gallesio writes:
> From: Erick Gallesio <Erick.Gallesio_at_unice.fr>
> To: "Albert L. Ting" <alt_at_artisan.com>
> Cc: stk_at_kaolin.unice.fr
> Subject: Re: buttons 2 and 3
> Date: Thu, 27 May 1999 10:36:15 +0200 (CEST)
>
> Albert L. Ting writes:
> >
> > Is there an easy way to make buttons 2 and 3 have the same animated
> > press/release action as button 1?
>
> Not sure to exactly answer your question. Anyway, the following code
> set the same behavior to buttons 2 and 3.
>
> (require "Tk-classes")
>
> (define b (make <Button> :text "Hello"
> :command (lambda () (display "Hello\n"))))
> (pack b)
>
> (let ((press (bind "Button" "<1>"))
> (release (bind "Button" "<ButtonRelease-1>")))
> (bind "Button" "<2>" press)
> (bind "Button" "<3>" press)
> (bind "Button" "<ButtonRelease-2>" release)
> (bind "Button" "<ButtonRelease-3>" release))
>
>
> The idea here is to get the binding associated to the button 1 (note
> that these bindings are class bindings set during the initialization
> of Tk) to button 2 and 3.
What I want is to have different commands for each button, and have each
button do the press/release action. Below is some sample code that works
in 3.1.1, but doesn't work in 3.99.4.
(require "Tk-classes")
(define (test2)
(let* ((b (make <Button> :text "Hello" ))
(press (bind "Button" "<1>"))
(release (bind "Button" "<ButtonRelease-1>")))
(pack b)
(bind b "<Button-2>" press)
(bind b "<ButtonRelease-2>" release)
(bind b "<Button-3>" press)
(bind b "<ButtonRelease-3>" release)
(add-binding b "<Button-1>" (lambda () (display "Hello 1\n")) #f)
(add-binding b "<Button-2>" (lambda () (display "Hello 2\n")) #f)
(add-binding b "<Button-3>" (lambda () (display "Hello 3\n")) #f)
))
Received on Thu May 27 1999 - 19:45:15 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST