racket/gui cocoa: fix crashing bug with combo-field%

Merge to v6.0
(cherry picked from commit 9a120f6acc)
This commit is contained in:
Matthew Flatt 2013-11-22 12:03:16 -07:00 committed by Ryan Culpepper
parent 687ed81d29
commit c044d0097a
2 changed files with 7 additions and 3 deletions

View File

@ -692,12 +692,13 @@
#t)
(define/public (on-combo-select i) (void))
(define/public (popup-combo)
;; Pending refresh events intefere with combo popups
;; Pending refresh events interfere with combo popups
;; for some reason, so flush them:
(yield-refresh)
(flush)
;; Beware that the `popUp:' method is undocumented:
(tellv (tell content-cocoa cell) popUp: #f))
(atomically
(tellv (tell content-cocoa cell) popUp: #f)))
(define clear-bg? (and (not (memq 'transparent canvas-style))
(not (memq 'no-autoclear canvas-style))))

View File

@ -1708,7 +1708,9 @@
(define (combo-frame empty?)
(define f (make-frame frame% "Combo Test"))
(define p f)
(define actual-content '("Apple" "Banana"))
(define actual-content (if empty?
null
'("Apple" "Banana")))
(define (callback c e) (void))
(define c (make-object (class combo-field%
(define/override (on-popup e)
@ -2402,6 +2404,7 @@
(make-object button% "Make Choice Frame" cp (lambda (b e) (choice-or-list-frame #f null #f)))
(make-object button% "Make Empty Choice Frame" cp (lambda (b e) (choice-or-list-frame #f null #t)))
(make-object button% "Make Combo Frame" cp (lambda (b e) (combo-frame #f)))
(make-object button% "Make Empty Combo Frame" cp (lambda (b e) (combo-frame #t)))
(define lcp (make-object horizontal-pane% ap))
(send lcp stretchable-width #f)
(define list-columns-choice (new choice%