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

Method NewAt

core/table.go:358–369  ·  view source on GitHub ↗

NewAt inserts a new blank element at the given index in the slice. -1 indicates to insert the element at the end.

(idx int)

Source from the content-addressed store, hash-verified

356// NewAt inserts a new blank element at the given index in the slice.
357// -1 indicates to insert the element at the end.
358func (tb *Table) NewAt(idx int) {
359 tb.NewAtSelect(idx)
360 reflectx.SliceNewAt(tb.Slice, idx)
361 if idx < 0 {
362 idx = tb.SliceSize
363 }
364
365 tb.This.(Lister).UpdateSliceSize()
366 tb.SelectIndexEvent(idx, events.SelectOne)
367 tb.UpdateChange()
368 tb.IndexGrabFocus(idx)
369}
370
371// DeleteAt deletes the element at the given index from the slice.
372func (tb *Table) DeleteAt(idx int) {

Callers

nothing calls this directly

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 6

SliceNewAtFunction · 0.92
NewAtSelectMethod · 0.80
SelectIndexEventMethod · 0.80
UpdateChangeMethod · 0.80
IndexGrabFocusMethod · 0.80
UpdateSliceSizeMethod · 0.65

Tested by

no test coverage detected