Fyne API "widget.Hyperlink"

widget.Hyperlink


import "fyne.io/fyne/v2/widget"

Usage

type Hyperlink struct {
	BaseWidget
	Text      string
	URL       *url.URL
	Alignment fyne.TextAlign // The alignment of the Text
	Wrapping  fyne.TextWrap  // The wrapping of the Text
	TextStyle fyne.TextStyle // The style of the hyperlink text

	// The truncation mode of the hyperlink
	//
	// Since: 2.5
	Truncation fyne.TextTruncation

	// The theme size name for the text size of the hyperlink
	//
	// Since: 2.5
	SizeName fyne.ThemeSizeName

	// OnTapped overrides the default `fyne.OpenURL` call when the link is tapped
	//
	// Since: 2.2
	OnTapped func() `json:"-"`
}

Hyperlink widget is a text component with appropriate padding and layout. When clicked, the default web browser should open with a URL

func NewHyperlink(text string, url *url.URL) *Hyperlink

NewHyperlink creates a new hyperlink widget with the set text content

func NewHyperlinkWithStyle

func NewHyperlinkWithStyle(text string, url *url.URL, alignment fyne.TextAlign, style fyne.TextStyle) *Hyperlink

NewHyperlinkWithStyle creates a new hyperlink widget with the set text content

func (hl *Hyperlink) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to its renderer

func (hl *Hyperlink) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (hl *Hyperlink) FocusGained()

FocusGained is a hook called by the focus handling logic after this object gained the focus.

func (hl *Hyperlink) FocusLost()

FocusLost is a hook called by the focus handling logic after this object lost the focus.

func (hl *Hyperlink) MinSize() fyne.Size

MinSize returns the smallest size this widget can shrink to

func (hl *Hyperlink) MouseIn(e *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (hl *Hyperlink) MouseMoved(e *desktop.MouseEvent)

MouseMoved is a hook that is called if the mouse pointer moved over the element.

func (hl *Hyperlink) MouseOut()

MouseOut is a hook that is called if the mouse pointer leaves the element.

func (hl *Hyperlink) Refresh()

Refresh triggers a redraw of the hyperlink.

Implements: fyne.Widget
func (hl *Hyperlink) Resize(size fyne.Size)

Resize sets a new size for the hyperlink. Note this should not be used if the widget is being managed by a Layout within a Container.

func (hl *Hyperlink) SetText(text string)

SetText sets the text of the hyperlink

func (hl *Hyperlink) SetURL(url *url.URL)

SetURL sets the URL of the hyperlink, taking in a URL type

func (hl *Hyperlink) SetURLFromString(str string) error

SetURLFromString sets the URL of the hyperlink, taking in a string type

func (hl *Hyperlink) Tapped(e *fyne.PointEvent)

Tapped is called when a pointer tapped event is captured and triggers any change handler

func (hl *Hyperlink) TypedKey(ev *fyne.KeyEvent)

TypedKey is a hook called by the input handling logic on key events if this object is focused.

func (hl *Hyperlink) TypedRune(rune)

TypedRune is a hook called by the input handling logic on text input events if this object is focused.