menu grab problem

From: Albert L. Ting <alt_at_vlibs.com>
Date: Tue, 22 Oct 1996 12:07:41 -0700 (PDT)

There's some kind of grab problem associated with the menu-button routines.
Below is some sample code that displays the problem. Normally, pressing
any key in the window will print to stdout "key pressed". However, if I
select the "File" button and then cancel the selection by clicking outside
the button, the <Any-Key> binding no longer works. If I move the mouse
outside the window and renter, the binding works again.

Albert

P.S. Once I'm in this grab "override" mode, I can also cause that 'catch'
bug I mentioned in a previous mail message. Although not too scientific,
but rapid typing on the alphanumeric keys will eventually create that catch
bug. It fails inside the Tk:traverse-within-menu routine, attempting to
call "(catch...(set! char2 (string-lower (string (string-ref label index)))))"
with index=-1.

--------------------------------------------------

(require "Tk-classes")
  
(define (setup)
  (let* ((menubar `(("File"
                     ("Edit" ,(lambda () (format #t "Editting\n")))
                     ("Save" ,(lambda () (format #t "Saving\n")))
                     ("Quit" ,bye))))
         (f (make <Frame>))
         (mb (make-menubar f menubar)))
    (pack mb)
    (pack f :padx 20 :pady 20)
    (bind *root* "<Any-Key>" (lambda () (format #t "key pressed\n")))
; also fails with add-binding
; (add-binding *root* "<t>"
; (lambda () (format #t "key-t pressed\n")) #f)
    ))

(setup)



-- 
Albert L. M. Ting * mail:alt_at_vlibs.com * phone:408-487-5327 * fax:408-453-3500
VLSI Libraries Incorporated, 2077 Gateway Place, Suite 300, San Jose, CA 95110
Received on Tue Oct 22 1996 - 21:30:58 CEST

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