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

Function InitWidget

widget.go:105–128  ·  view source on GitHub ↗

InitWidget initializes a Widget.

(widget Widget, parent Window, className string, style, exStyle uint32)

Source from the content-addressed store, hash-verified

103
104// InitWidget initializes a Widget.
105func InitWidget(widget Widget, parent Window, className string, style, exStyle uint32) error {
106 if parent == nil {
107 return newError("parent cannot be nil")
108 }
109
110 if err := InitWindow(widget, parent, className, style|win.WS_CHILD, exStyle); err != nil {
111 return err
112 }
113
114 if container, ok := parent.(Container); ok {
115 if container.Children() == nil {
116 // Required by parents like MainWindow and GroupBox.
117 if win.SetParent(widget.Handle(), container.Handle()) == 0 {
118 return lastError("SetParent")
119 }
120 } else {
121 if err := container.Children().Add(widget); err != nil {
122 return err
123 }
124 }
125 }
126
127 return nil
128}
129
130func (wb *WidgetBase) init(widget Widget) error {
131 wb.graphicsEffects = newWidgetGraphicsEffectList(wb)

Callers 15

newSplitterFunction · 0.85
NewStatusBarFunction · 0.85
NewGroupBoxFunction · 0.85
NewRadioButtonFunction · 0.85
newSpacerFunction · 0.85
NewProgressBarFunction · 0.85
NewNumberEditFunction · 0.85
initMethod · 0.85
NewScrollViewFunction · 0.85
NewSplitButtonFunction · 0.85
NewTableViewWithCfgFunction · 0.85
NewLinkLabelFunction · 0.85

Calls 7

newErrorFunction · 0.85
InitWindowFunction · 0.85
lastErrorFunction · 0.85
ChildrenMethod · 0.65
SetParentMethod · 0.65
HandleMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…