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)
This commit is contained in:
parent
fe0525b7bb
commit
e1303dc400
|
@ -28,7 +28,7 @@
|
||||||
(-a _void (clicked: [_id sender])
|
(-a _void (clicked: [_id sender])
|
||||||
;; In case we were in 0-item mode, switch to Radio mode to
|
;; In case we were in 0-item mode, switch to Radio mode to
|
||||||
;; ensure that only one button is selected:
|
;; 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)))))
|
(queue-window*-event wxb (lambda (wx) (send wx clicked)))))
|
||||||
|
|
||||||
(define-objc-class MyImageButtonCell NSButtonCell
|
(define-objc-class MyImageButtonCell NSButtonCell
|
||||||
|
@ -129,13 +129,12 @@
|
||||||
(define/public (set-selection i)
|
(define/public (set-selection i)
|
||||||
(if (= i -1)
|
(if (= i -1)
|
||||||
(begin
|
(begin
|
||||||
;; Need to change to NSListModeMatrix to disable all.
|
(tellv (get-cocoa) setAllowsEmptySelection: #:type _BOOL #t)
|
||||||
(tellv (get-cocoa) setMode: #:type _int NSListModeMatrix)
|
|
||||||
(tellv (get-cocoa) deselectAllCells))
|
(tellv (get-cocoa) deselectAllCells))
|
||||||
(begin
|
(begin
|
||||||
(tellv (get-cocoa) setMode: #:type _int NSRadioModeMatrix)
|
|
||||||
(tellv (get-cocoa) selectCellAtRow: #:type _NSInteger (if horiz? 0 i)
|
(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)
|
(define/public (get-selection)
|
||||||
(let ([c (tell (get-cocoa) selectedCell)]
|
(let ([c (tell (get-cocoa) selectedCell)]
|
||||||
[pos (if horiz?
|
[pos (if horiz?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user