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

Function widgetNextSibling

core/widget.go:472–483  ·  view source on GitHub ↗

widgetNextSibling returns next sibling or nil if none, including Parts, which are considered to come after Children.

(w Widget)

Source from the content-addressed store, hash-verified

470// widgetNextSibling returns next sibling or nil if none,
471// including Parts, which are considered to come after Children.
472func widgetNextSibling(w Widget) Widget {
473 wb := w.AsWidget()
474 if wb.Parent == nil {
475 return nil
476 }
477 parent := wb.Parent.(Widget)
478 myidx := wb.IndexInParent()
479 if myidx >= 0 && myidx < wb.Parent.AsTree().NumChildren()-1 {
480 return parent.AsTree().Child(myidx + 1).(Widget)
481 }
482 return widgetNextSibling(parent)
483}
484
485// widgetPrev returns the previous widget in the tree,
486// including Parts, which are considered to come after Children.

Callers 1

widgetNextFunction · 0.85

Calls 5

IndexInParentMethod · 0.80
NumChildrenMethod · 0.80
ChildMethod · 0.80
AsWidgetMethod · 0.65
AsTreeMethod · 0.65

Tested by

no test coverage detected