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

Method InsertChild

tree/nodebase.go:328–332  ·  view source on GitHub ↗

InsertChild adds given child at position in children list. The kid node is assumed to not be on another tree (see [MoveToParent]) and the existing name should be unique among children.

(kid Node, index int)

Source from the content-addressed store, hash-verified

326// The kid node is assumed to not be on another tree (see [MoveToParent])
327// and the existing name should be unique among children.
328func (n *NodeBase) InsertChild(kid Node, index int) {
329 InitNode(kid)
330 n.Children = slices.Insert(n.Children, index, kid)
331 SetParent(kid, n)
332}
333
334// Deleting Children:
335

Callers 9

addTreeNodesMethod · 0.80
addSyncNodesMethod · 0.80
DuplicateMethod · 0.80
duplicateSyncMethod · 0.80
pasteAtSyncMethod · 0.80
pasteAtMethod · 0.80
insertNewTabMethod · 0.80
insertTabOnlyAtMethod · 0.80
UnmarshalJSONMethod · 0.80

Calls 3

InitNodeFunction · 0.85
SetParentFunction · 0.85
InsertMethod · 0.45

Tested by

no test coverage detected