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

Function widgetNextFunc

core/widget.go:520–535  ·  view source on GitHub ↗

widgetNextFunc returns the next widget in the tree, including Parts, which are considered to come after children, continuing until the given function returns true. nil if no more.

(w Widget, fun func(w Widget) bool)

Source from the content-addressed store, hash-verified

518// continuing until the given function returns true.
519// nil if no more.
520func widgetNextFunc(w Widget, fun func(w Widget) bool) Widget {
521 for {
522 nw := widgetNext(w)
523 if nw == nil {
524 return nil
525 }
526 if fun(nw) {
527 return nw
528 }
529 if nw == w {
530 slog.Error("WidgetNextFunc", "start", w, "nw == wi", nw)
531 return nil
532 }
533 w = nw
534 }
535}
536
537// widgetPrevFunc returns the previous widget in the tree,
538// including Parts, which are considered to come after children,

Callers 2

FocusNextFromMethod · 0.85
TestWidgetNextFunction · 0.85

Calls 2

widgetNextFunction · 0.85
ErrorMethod · 0.65

Tested by 1

TestWidgetNextFunction · 0.68