From 58f6bed7e4db2b571cdd8ca21b1765615cad269f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 24 Feb 2014 14:49:46 -0500 Subject: [PATCH] Set the default control font on Windows to the expected standard font instead of to the default System font. --- sysdata_windows.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sysdata_windows.go b/sysdata_windows.go index f311187..7c904ae 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -24,6 +24,7 @@ type classData struct { xstyle uint32 mkid bool altStyle uint32 + font *_HANDLE appendMsg uintptr insertBeforeMsg uintptr deleteMsg uintptr @@ -44,17 +45,20 @@ var classTypes = [nctypes]*classData{ name: "BUTTON", style: _BS_PUSHBUTTON | controlstyle, xstyle: 0 | controlxstyle, + font: &controlFont, }, c_checkbox: &classData{ name: "BUTTON", style: _BS_AUTOCHECKBOX | controlstyle, xstyle: 0 | controlxstyle, + font: &controlFont, }, c_combobox: &classData{ name: "COMBOBOX", style: _CBS_DROPDOWNLIST | _WS_VSCROLL | controlstyle, xstyle: 0 | controlxstyle, altStyle: _CBS_DROPDOWN | _CBS_AUTOHSCROLL | _WS_VSCROLL | controlstyle, + font: &controlFont, appendMsg: _CB_ADDSTRING, insertBeforeMsg: _CB_INSERTSTRING, deleteMsg: _CB_DELETESTRING, @@ -66,11 +70,13 @@ var classTypes = [nctypes]*classData{ name: "EDIT", style: _ES_AUTOHSCROLL | _WS_BORDER | controlstyle, xstyle: 0 | controlxstyle, + font: &controlFont, }, c_label: &classData{ name: "STATIC", style: _SS_NOPREFIX | controlstyle, xstyle: 0 | controlxstyle, + font: &controlFont, }, c_listbox: &classData{ name: "LISTBOX", @@ -78,6 +84,7 @@ var classTypes = [nctypes]*classData{ style: _WS_VSCROLL | controlstyle, xstyle: 0 | controlxstyle, altStyle: _LBS_EXTENDEDSEL | _WS_VSCROLL | controlstyle, + font: &controlFont, appendMsg: _LB_ADDSTRING, insertBeforeMsg: _LB_INSERTSTRING, deleteMsg: _LB_DELETESTRING, @@ -151,6 +158,19 @@ func (s *sysData) make(initText string, window *sysData) (err error) { return fmt.Errorf("error actually creating window/control: %v", r.err) } s.hwnd = _HWND(r.ret) + if ct.font != nil { + uitask <- &uimsg{ + call: _sendMessage, + p: []uintptr{ + uintptr(s.hwnd), + uintptr(_WM_SETFONT), + uintptr(_WPARAM(*ct.font)), + uintptr(_LPARAM(_TRUE)), + }, + ret: ret, + } + <-ret + } return nil }