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

Method On

core/widgetevents.go:48–50  ·  view source on GitHub ↗

On adds the given event handler to the [WidgetBase.Listeners.Normal] for the given event type. Listeners are called in sequential descending order, so this listener will be called before all of the ones added before it. On is one of the main ways to add an event handler to a widget, in addition to O

(etype events.Types, fun func(e events.Event))

Source from the content-addressed store, hash-verified

46// event handlers that are called before and after those added by this function,
47// respectively.
48func (wb *WidgetBase) On(etype events.Types, fun func(e events.Event)) {
49 wb.Listeners.Normal.Add(etype, fun)
50}
51
52// OnFirst adds the given event handler to the [WidgetBase.Listeners.First] for the given
53// event type. FirstListeners are called in sequential descending order, so this first

Callers 14

OnClickMethod · 0.95
OnDoubleClickMethod · 0.95
OnChangeMethod · 0.95
OnInputMethod · 0.95
OnKeyChordMethod · 0.95
OnFocusMethod · 0.95
OnFocusLostMethod · 0.95
OnSelectMethod · 0.95
OnShowMethod · 0.95
OnCloseMethod · 0.95

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected