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

Method SetCompleter

core/textfield.go:1195–1204  ·  view source on GitHub ↗

Complete SetCompleter sets completion functions so that completions will automatically be offered as the user types.

(data any, matchFun complete.MatchFunc, editFun complete.EditFunc)

Source from the content-addressed store, hash-verified

1193// SetCompleter sets completion functions so that completions will
1194// automatically be offered as the user types.
1195func (tf *TextField) SetCompleter(data any, matchFun complete.MatchFunc, editFun complete.EditFunc) {
1196 if matchFun == nil || editFun == nil {
1197 tf.complete = nil
1198 return
1199 }
1200 tf.complete = NewComplete().SetContext(data).SetMatchFunc(matchFun).SetEditFunc(editFun)
1201 tf.complete.OnSelect(func(e events.Event) {
1202 tf.completeText(tf.complete.Completion)
1203 })
1204}
1205
1206// offerComplete pops up a menu of possible completions
1207func (tf *TextField) offerComplete() {

Callers 2

makeSelectedRowMethod · 0.80
InitMethod · 0.80

Calls 6

completeTextMethod · 0.95
NewCompleteFunction · 0.85
SetEditFuncMethod · 0.80
SetMatchFuncMethod · 0.80
SetContextMethod · 0.45
OnSelectMethod · 0.45

Tested by

no test coverage detected