racket/gui cocoa: fix swapping of buttons with the 'border style

Register a button as a default button every time that it is shown,
so that multiple buttons in a frame can have the 'border style
(as long as only one is shown at a time).
This commit is contained in:
Matthew Flatt 2013-04-20 08:50:12 -06:00
parent 82457258e2
commit a9cc79c89b

View File

@ -150,8 +150,10 @@
[no-show? (memq 'deleted style)] [no-show? (memq 'deleted style)]
[callback cb]) [callback cb])
(when (memq 'border style) (define default-button? (memq 'border style))
(tellv (get-cocoa-window) setDefaultButtonCell: (tell button-cocoa cell))) (define/override (show-children)
(when default-button?
(tellv (get-cocoa-window) setDefaultButtonCell: (tell button-cocoa cell))))
(tellv button-cocoa setTarget: button-cocoa) (tellv button-cocoa setTarget: button-cocoa)
(tellv button-cocoa setAction: #:type _SEL (selector clicked:)) (tellv button-cocoa setAction: #:type _SEL (selector clicked:))