MCPcopy Create free account
hub / github.com/lxn/walk / ensureProperDialogDefaultButton

Method ensureProperDialogDefaultButton

pushbutton.go:51–83  ·  view source on GitHub ↗
(hwndFocus win.HWND)

Source from the content-addressed store, hash-verified

49}
50
51func (pb *PushButton) ensureProperDialogDefaultButton(hwndFocus win.HWND) {
52 widget := windowFromHandle(hwndFocus)
53 if widget == nil {
54 return
55 }
56
57 if _, ok := widget.(*PushButton); ok {
58 return
59 }
60
61 form := ancestor(pb)
62 if form == nil {
63 return
64 }
65
66 dlg, ok := form.(dialogish)
67 if !ok {
68 return
69 }
70
71 defBtn := dlg.DefaultButton()
72 if defBtn == nil {
73 return
74 }
75
76 if err := defBtn.setAndClearStyleBits(win.BS_DEFPUSHBUTTON, win.BS_PUSHBUTTON); err != nil {
77 return
78 }
79
80 if err := defBtn.Invalidate(); err != nil {
81 return
82 }
83}
84
85func (pb *PushButton) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
86 switch msg {

Callers 1

WndProcMethod · 0.95

Calls 5

windowFromHandleFunction · 0.85
ancestorFunction · 0.85
setAndClearStyleBitsMethod · 0.80
DefaultButtonMethod · 0.65
InvalidateMethod · 0.65

Tested by

no test coverage detected