win32: fix horizontal `radio-box%'

Merge to 5.1
(cherry picked from commit 8f404a4618)
This commit is contained in:
Matthew Flatt 2011-02-04 09:19:19 -07:00 committed by Ryan Culpepper
parent 9721ad1ce7
commit 08ff71d1a1

View File

@ -49,6 +49,7 @@
(define label-bitmaps null)
(define radio-hwnds
(let ([horiz? (memq 'horizontal style)])
(let loop ([y 0] [w 0] [labels labels])
(if (null? labels)
(begin
@ -80,11 +81,15 @@
(set-control-font font radio-hwnd)
(let-values ([(w1 h)
(auto-size font label 0 0 20 4
(lambda (w h)
(MoveWindow radio-hwnd 0 (+ y SEP) w h #t)
(values w h)))])
(lambda (w1 h1)
(if horiz?
(MoveWindow radio-hwnd (+ w SEP) 0 w1 h1 #t)
(MoveWindow radio-hwnd 0 (+ y SEP) w1 h1 #t))
(values w1 h1)))])
(cons radio-hwnd
(loop (+ y SEP h) (max w1 w) (cdr labels))))))))
(loop (if horiz? (max y h) (+ y SEP h))
(if horiz? (+ w SEP w1) (max w1 w))
(cdr labels)))))))))
(unless (= val -1)
(SendMessageW (list-ref radio-hwnds val) BM_SETCHECK 1 0))