win32: fix combo% on-popup

This commit is contained in:
Matthew Flatt 2010-11-05 14:05:31 -06:00
parent 7a3e132a96
commit f935266257
3 changed files with 15 additions and 9 deletions

View File

@ -454,16 +454,21 @@
(define/public (append-combo-item s)
(SendMessageW/str combo-hwnd CB_ADDSTRING 0 s))
(define/public (clear-combo-items)
(void))
(SendMessageW combo-hwnd CB_RESETCONTENT 0 0))
(define/public (on-popup) (void))
(define/override (is-command? cmd)
(= cmd CBN_SELENDOK))
(or (= cmd CBN_SELENDOK)
(= cmd CBN_DROPDOWN)))
(define/public (do-command cmd control-hwnd)
(let ([i (SendMessageW combo-hwnd CB_GETCURSEL 0 0)])
(queue-window-event this (lambda () (on-combo-select i)))))
(cond
[(= cmd CBN_SELENDOK)
(let ([i (SendMessageW combo-hwnd CB_GETCURSEL 0 0)])
(queue-window-event this (lambda () (on-combo-select i))))]
[(= cmd CBN_DROPDOWN)
(constrained-reply (get-eventspace) (lambda () (on-popup)) (void))]))
(define/override (is-hwnd? a-hwnd)
(or (ptr-equal? panel-hwnd a-hwnd)

View File

@ -15,10 +15,6 @@
(provide
(protect-out choice%))
(define CBN_DROPDOWN 7)
(define CBN_CLOSEUP 8)
(define CBN_SELENDCANCEL 10)
(define choice%
(class item%
(init parent cb label

View File

@ -616,6 +616,11 @@
(define CB_INSERTSTRING #x014A)
(define CB_SETCURSEL #x014E)
(define CB_GETCURSEL #x0147)
(define CBN_SELENDOK 9)
(define CB_ADDSTRING #x0143)
(define CB_RESETCONTENT #x014B)
(define CBN_SELENDOK 9)
(define CBN_DROPDOWN 7)
(define CBN_CLOSEUP 8)
(define CBN_SELENDCANCEL 10)