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

Method Send

core/widgetevents.go:169–181  ·  view source on GitHub ↗

Send sends an new event of the given type to this widget, optionally starting from values in the given original event (recommended to include where possible). Do not send an existing event using this method if you want the Handled state to persist throughout the call chain; call HandleEvent directly

(typ events.Types, original ...events.Event)

Source from the content-addressed store, hash-verified

167// want the Handled state to persist throughout the call chain;
168// call HandleEvent directly for any existing events.
169func (wb *WidgetBase) Send(typ events.Types, original ...events.Event) {
170 if wb.This == nil {
171 return
172 }
173 var e events.Event
174 if len(original) > 0 && original[0] != nil {
175 e = original[0].NewFromClone(typ)
176 } else {
177 e = &events.Base{Typ: typ}
178 e.Init()
179 }
180 wb.HandleEvent(e)
181}
182
183// SendChange sends a new [events.Change] event, which is widely used to signal
184// value changing for most widgets. It takes the event that the new change event

Callers 15

SendChangeMethod · 0.95
handleWidgetClickMethod · 0.95
TestHandleWidgetStateFunction · 0.95
TestKeyedListChangeFunction · 0.45
CallFuncMethod · 0.45
showReturnsDialogMethod · 0.45
TestTabsClickFunction · 0.45
TestTabsNewClickFunction · 0.45
sendSelectEventMethod · 0.45
InitMethod · 0.45

Calls 3

InitMethod · 0.95
HandleEventMethod · 0.95
NewFromCloneMethod · 0.65

Tested by 15

TestHandleWidgetStateFunction · 0.76
TestKeyedListChangeFunction · 0.36
TestTabsClickFunction · 0.36
TestTabsNewClickFunction · 0.36
TestSpinnerButtonsFunction · 0.36
TestSpinnerStepFunction · 0.36
TestSpinnerChangeButtonFunction · 0.36
TestSwitchChangeFunction · 0.36
TestTextFieldClearClickFunction · 0.36
TestTextFieldIconsFunction · 0.36
TestFormChangeFunction · 0.36