MCPcopy
hub / github.com/lxn/walk / NewGroupBox

Function NewGroupBox

groupbox.go:33–114  ·  view source on GitHub ↗
(parent Container)

Source from the content-addressed store, hash-verified

31}
32
33func NewGroupBox(parent Container) (*GroupBox, error) {
34 gb := new(GroupBox)
35
36 if err := InitWidget(
37 gb,
38 parent,
39 groupBoxWindowClass,
40 win.WS_VISIBLE,
41 win.WS_EX_CONTROLPARENT); err != nil {
42 return nil, err
43 }
44
45 succeeded := false
46 defer func() {
47 if !succeeded {
48 gb.Dispose()
49 }
50 }()
51
52 gb.hWndGroupBox = win.CreateWindowEx(
53 0, syscall.StringToUTF16Ptr("BUTTON"), nil,
54 win.WS_CHILD|win.WS_VISIBLE|win.BS_GROUPBOX,
55 0, 0, 80, 24, gb.hWnd, 0, 0, nil)
56 if gb.hWndGroupBox == 0 {
57 return nil, lastError("CreateWindowEx(BUTTON)")
58 }
59 win.SetWindowLong(gb.hWndGroupBox, win.GWL_ID, 1)
60
61 gb.applyFont(gb.Font())
62 gb.updateHeaderHeight()
63
64 var err error
65
66 gb.checkBox, err = NewCheckBox(gb)
67 if err != nil {
68 return nil, err
69 }
70 win.SetWindowLong(gb.checkBox.hWnd, win.GWL_ID, 2)
71
72 gb.SetCheckable(false)
73 gb.checkBox.SetChecked(true)
74
75 gb.checkBox.CheckedChanged().Attach(func() {
76 gb.applyEnabledFromCheckBox(gb.checkBox.Checked())
77 })
78
79 setWindowVisible(gb.checkBox.hWnd, false)
80
81 gb.composite, err = NewComposite(gb)
82 if err != nil {
83 return nil, err
84 }
85 win.SetWindowLong(gb.composite.hWnd, win.GWL_ID, 3)
86 gb.composite.name = "composite"
87
88 win.SetWindowPos(gb.checkBox.hWnd, win.HWND_TOP, 0, 0, 0, 0, win.SWP_NOMOVE|win.SWP_NOSIZE)
89
90 gb.SetBackground(NullBrush())

Callers

nothing calls this directly

Calls 15

InitWidgetFunction · 0.85
lastErrorFunction · 0.85
NewCheckBoxFunction · 0.85
setWindowVisibleFunction · 0.85
NewCompositeFunction · 0.85
NullBrushFunction · 0.85
NewPropertyFunction · 0.85
assertStringOrFunction · 0.85
NewBoolPropertyFunction · 0.85
updateHeaderHeightMethod · 0.80
MustRegisterPropertyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…