From a9cc79c89b438cf8eda9b66541f1cfaf6b3c1e4c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 20 Apr 2013 08:50:12 -0600 Subject: [PATCH] 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). --- collects/mred/private/wx/cocoa/button.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/collects/mred/private/wx/cocoa/button.rkt b/collects/mred/private/wx/cocoa/button.rkt index d49171af2f..288413b5a2 100644 --- a/collects/mred/private/wx/cocoa/button.rkt +++ b/collects/mred/private/wx/cocoa/button.rkt @@ -150,8 +150,10 @@ [no-show? (memq 'deleted style)] [callback cb]) - (when (memq 'border style) - (tellv (get-cocoa-window) setDefaultButtonCell: (tell button-cocoa cell))) + (define default-button? (memq 'border style)) + (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 setAction: #:type _SEL (selector clicked:))