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

Function widgetPrevFunc

core/widget.go:541–556  ·  view source on GitHub ↗

widgetPrevFunc returns the previous 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

539// continuing until the given function returns true.
540// nil if no more.
541func widgetPrevFunc(w Widget, fun func(w Widget) bool) Widget {
542 for {
543 pw := widgetPrev(w)
544 if pw == nil {
545 return nil
546 }
547 if fun(pw) {
548 return pw
549 }
550 if pw == w {
551 slog.Error("WidgetPrevFunc", "start", w, "pw == wi", pw)
552 return nil
553 }
554 w = pw
555 }
556}
557
558// WidgetTooltip is the base implementation of [Widget.WidgetTooltip],
559// which just returns [WidgetBase.Tooltip] and [WidgetBase.DefaultTooltipPos].

Callers 2

focusPrevFromMethod · 0.85
TestWidgetPrevFunction · 0.85

Calls 2

widgetPrevFunction · 0.85
ErrorMethod · 0.65

Tested by 1

TestWidgetPrevFunction · 0.68