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

Method setScene

core/widget.go:295–300  ·  view source on GitHub ↗

setScene sets the Scene pointer for this widget and all of its children. This can be necessary when creating widgets outside the usual New* paradigm, e.g., when reading from a JSON file.

(sc *Scene)

Source from the content-addressed store, hash-verified

293// This can be necessary when creating widgets outside the usual New* paradigm,
294// e.g., when reading from a JSON file.
295func (wb *WidgetBase) setScene(sc *Scene) {
296 wb.WidgetWalkDown(func(cw Widget, cwb *WidgetBase) bool {
297 cwb.Scene = sc
298 return tree.Continue
299 })
300}
301
302// AsWidget returns the given [tree.Node] as a [WidgetBase] or nil.
303func AsWidget(n tree.Node) *WidgetBase {

Callers

nothing calls this directly

Calls 1

WidgetWalkDownMethod · 0.95

Tested by

no test coverage detected