Complete SetCompleter sets completion functions so that completions will automatically be offered as the user types.
(data any, matchFun complete.MatchFunc, editFun complete.EditFunc)
| 1193 | // SetCompleter sets completion functions so that completions will |
| 1194 | // automatically be offered as the user types. |
| 1195 | func (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 |
| 1207 | func (tf *TextField) offerComplete() { |
no test coverage detected