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

Method HandleTextClick

core/text.go:255–264  ·  view source on GitHub ↗

HandleTextClick handles click events such that the given function will be called on any links that are clicked on.

(openLink func(tl *paint.TextLink))

Source from the content-addressed store, hash-verified

253// HandleTextClick handles click events such that the given function will be called
254// on any links that are clicked on.
255func (tx *Text) HandleTextClick(openLink func(tl *paint.TextLink)) {
256 tx.OnClick(func(e events.Event) {
257 tl, _ := tx.findLink(e.Pos())
258 if tl == nil {
259 return
260 }
261 openLink(tl)
262 e.SetHandled()
263 })
264}
265
266func (tx *Text) WidgetTooltip(pos image.Point) (string, image.Point) {
267 if pos == image.Pt(-1, -1) {

Callers 4

InitMethod · 0.95
handleTextFunction · 0.80
handleTextTagFunction · 0.80
OpenURLMethod · 0.80

Calls 4

findLinkMethod · 0.95
PosMethod · 0.65
SetHandledMethod · 0.65
OnClickMethod · 0.45

Tested by

no test coverage detected