From bb44712fad85ad7262ab6b82b3056753e4f1f20e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 5 Jun 2014 18:28:40 -0400 Subject: Changed Checkbox on Windows to use BS_CHECKBOX instead of BS_AUTOCHECKBOX; this will be necessary to fix the focus issue in todo.md (see http://blogs.msdn.com/b/oldnewthing/archive/2014/05/22/10527522.aspx). --- stdwndclass_windows.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'stdwndclass_windows.go') diff --git a/stdwndclass_windows.go b/stdwndclass_windows.go index f4004e4..7ec25fb 100644 --- a/stdwndclass_windows.go +++ b/stdwndclass_windows.go @@ -84,6 +84,25 @@ func stdWndProc(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM) _LRESUL if wParam.HIWORD() == _BN_CLICKED { ss.signal() } + case c_checkbox: + // we opt into doing this ourselves because http://blogs.msdn.com/b/oldnewthing/archive/2014/05/22/10527522.aspx + if wParam.HIWORD() == _BN_CLICKED { + state, _, _ := _sendMessage.Call( + uintptr(ss.hwnd), + uintptr(_BM_GETCHECK), + uintptr(0), + uintptr(0)) + if state == _BST_CHECKED { + state = _BST_UNCHECKED + } else if state == _BST_UNCHECKED { + state = _BST_CHECKED + } + _sendMessage.Call( + uintptr(ss.hwnd), + uintptr(_BM_SETCHECK), + state, // already uintptr + uintptr(0)) + } } return 0 case _WM_GETMINMAXINFO: -- cgit v1.2.3