Re: buttons 2 and 3

From: Erick Gallesio <>
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.

Hope that I'm answering your question.

                -- Erick
Received on Thu May 27 1999 - 11:13:59 CEST

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