MCPcopy Create free account
hub / github.com/cogentcore/core / ForWidgetChildren

Method ForWidgetChildren

core/widget.go:418–425  ·  view source on GitHub ↗

ForWidgetChildren iterates through the children as widgets, calling the given function. Return [tree.Continue] (true) to continue, and [tree.Break] (false) to terminate.

(fun func(i int, cw Widget, cwb *WidgetBase) bool)

Source from the content-addressed store, hash-verified

416// ForWidgetChildren iterates through the children as widgets, calling the given function.
417// Return [tree.Continue] (true) to continue, and [tree.Break] (false) to terminate.
418func (wb *WidgetBase) ForWidgetChildren(fun func(i int, cw Widget, cwb *WidgetBase) bool) {
419 for i, c := range wb.Children {
420 w, cwb := c.(Widget), AsWidget(c)
421 if !fun(i, w, cwb) {
422 break
423 }
424 }
425}
426
427// forVisibleChildren iterates through the children,as widgets, calling the given function,
428// excluding any with the *local* states.Invisible flag set (does not check parents).

Callers 15

renderChildrenMethod · 0.95
SizeFinalMethod · 0.80
RenderWidgetMethod · 0.80
SizeUpMethod · 0.80
PositionMethod · 0.80
SizeFinalMethod · 0.80
RenderChildrenMethod · 0.80
childWithFocusMethod · 0.80
sizeUpChildrenMethod · 0.80
sizeDownChildrenMethod · 0.80
sizeDownGrowStackedMethod · 0.80

Calls 1

AsWidgetFunction · 0.85

Tested by

no test coverage detected