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

Method SetStretchFactor

flowlayout.go:39–60  ·  view source on GitHub ↗
(widget Widget, factor int)

Source from the content-addressed store, hash-verified

37}
38
39func (l *FlowLayout) SetStretchFactor(widget Widget, factor int) error {
40 if factor != l.StretchFactor(widget) {
41 if l.container == nil {
42 return newError("container required")
43 }
44
45 handle := widget.Handle()
46
47 if !l.container.Children().containsHandle(handle) {
48 return newError("unknown widget")
49 }
50 if factor < 1 {
51 return newError("factor must be >= 1")
52 }
53
54 l.hwnd2StretchFactor[handle] = factor
55
56 l.container.RequestLayout()
57 }
58
59 return nil
60}
61
62func (l *FlowLayout) CreateLayoutItem(ctx *LayoutContext) ContainerLayoutItem {
63 li := &flowLayoutItem{

Callers

nothing calls this directly

Calls 6

StretchFactorMethod · 0.95
newErrorFunction · 0.85
HandleMethod · 0.65
containsHandleMethod · 0.65
ChildrenMethod · 0.65
RequestLayoutMethod · 0.65

Tested by

no test coverage detected