Exemple #1
0
func newButton(text string) *button {
	hwnd := C.newControl(buttonclass,
		C.BS_PUSHBUTTON|C.WS_TABSTOP,
		0)
	b := &button{
		_hwnd:   hwnd,
		clicked: newEvent(),
	}
	b.SetText(text)
	C.controlSetControlFont(b._hwnd)
	C.setButtonSubclass(b._hwnd, unsafe.Pointer(b))
	return b
}
Exemple #2
0
func newButton(text string) *button {
	hwnd := C.newControl(buttonclass,
		C.BS_PUSHBUTTON|C.WS_TABSTOP,
		0)
	b := &button{
		controlSingleHWNDWithText: newControlSingleHWNDWithText(hwnd),
		clicked:                   newEvent(),
	}
	b.fpreferredSize = b.xpreferredSize
	b.SetText(text)
	C.controlSetControlFont(b.hwnd)
	C.setButtonSubclass(b.hwnd, unsafe.Pointer(b))
	return b
}