From 8b7ca5060515aef2fa4fdf1d9122b65786799ae8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 4 Feb 2011 08:49:22 -0700 Subject: [PATCH] cocoa: change `radio-box%' implementation of no selected buttons (not sure how I missed the `setAllowsEmptySelection' method before, but maybe there was some reason to avoid it that I've forgotten --- so *don't* merge to 5.1) original commit: e1303dc4006951d7c9e1ebee31d0f5a76ab3c40e --- collects/mred/private/wx/cocoa/radio-box.rkt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/collects/mred/private/wx/cocoa/radio-box.rkt b/collects/mred/private/wx/cocoa/radio-box.rkt index 558418df..d52ef155 100644 --- a/collects/mred/private/wx/cocoa/radio-box.rkt +++ b/collects/mred/private/wx/cocoa/radio-box.rkt @@ -28,7 +28,7 @@ (-a _void (clicked: [_id sender]) ;; In case we were in 0-item mode, switch to Radio mode to ;; ensure that only one button is selected: - (tellv self setMode: #:type _int NSRadioModeMatrix) + (tellv self setAllowsEmptySelection: #:type _BOOL #f) (queue-window*-event wxb (lambda (wx) (send wx clicked))))) (define-objc-class MyImageButtonCell NSButtonCell @@ -129,13 +129,12 @@ (define/public (set-selection i) (if (= i -1) (begin - ;; Need to change to NSListModeMatrix to disable all. - (tellv (get-cocoa) setMode: #:type _int NSListModeMatrix) + (tellv (get-cocoa) setAllowsEmptySelection: #:type _BOOL #t) (tellv (get-cocoa) deselectAllCells)) (begin - (tellv (get-cocoa) setMode: #:type _int NSRadioModeMatrix) (tellv (get-cocoa) selectCellAtRow: #:type _NSInteger (if horiz? 0 i) - column: #:type _NSInteger (if horiz? i 0))))) + column: #:type _NSInteger (if horiz? i 0)) + (tellv (get-cocoa) setAllowsEmptySelection: #:type _BOOL #f)))) (define/public (get-selection) (let ([c (tell (get-cocoa) selectedCell)] [pos (if horiz?