Fyne API "widget.Entry"

widget.Entry


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

Usage

type Entry

type Entry struct {
	DisableableWidget

	Text string
	// Since: 2.0
	TextStyle   fyne.TextStyle
	PlaceHolder string
	OnChanged   func(string) `json:"-"`
	// Since: 2.0
	OnSubmitted func(string) `json:"-"`
	Password    bool
	MultiLine   bool
	Wrapping    fyne.TextWrap

	// Set a validator that this entry will check against
	// Since: 1.4
	Validator fyne.StringValidator

	CursorRow, CursorColumn int
	OnCursorChanged         func() `json:"-"`

	// ActionItem is a small item which is displayed at the outer right of the entry (like a password revealer)
	ActionItem fyne.CanvasObject
}

Entry widget allows simple text to be input when focused.

func NewEntry

func NewEntry() *Entry

NewEntry creates a new single line entry widget.

func NewEntryWithData

func NewEntryWithData(data binding.String) *Entry

NewEntryWithData returns an Entry widget connected to the specified data source.

Since: 2.0

func NewMultiLineEntry

func NewMultiLineEntry() *Entry

NewMultiLineEntry creates a new entry that allows multiple lines

func NewPasswordEntry

func NewPasswordEntry() *Entry

NewPasswordEntry creates a new entry password widget

func (*Entry) Bind

func (e *Entry) Bind(data binding.String)

Bind connects the specified data source to this Entry. The current value will be displayed and any changes in the data will cause the widget to update. User interactions with this Entry will set the value into the data source.

Since: 2.0

func (*Entry) CreateRenderer

func (e *Entry) CreateRenderer() fyne.WidgetRenderer

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

Implements: fyne.Widget

func (*Entry) Cursor

func (e *Entry) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

Implements: desktop.Cursorable

func (*Entry) Disable

func (e *Entry) Disable()

Disable this widget so that it cannot be interacted with, updating any style appropriately.

Implements: fyne.Disableable

func (*Entry) Disabled

func (e *Entry) Disabled() bool

Disabled returns whether the entry is disabled or read-only.

Implements: fyne.Disableable

func (*Entry) DoubleTapped

func (e *Entry) DoubleTapped(p *fyne.PointEvent)

DoubleTapped is called when this entry has been double tapped so we should select text below the pointer

Implements: fyne.DoubleTappable

func (*Entry) DragEnd

func (e *Entry) DragEnd()

DragEnd is called at end of a drag event.

Implements: fyne.Draggable

func (*Entry) Dragged

func (e *Entry) Dragged(d *fyne.DragEvent)

Dragged is called when the pointer moves while a button is held down. It updates the selection accordingly.

Implements: fyne.Draggable

func (*Entry) Enable

func (e *Entry) Enable()

Enable this widget, updating any style or features appropriately.

Implements: fyne.Disableable

func (*Entry) ExtendBaseWidget

func (e *Entry) ExtendBaseWidget(wid fyne.Widget)

ExtendBaseWidget is used by an extending widget to make use of BaseWidget functionality.

func (*Entry) FocusGained

func (e *Entry) FocusGained()

FocusGained is called when the Entry has been given focus.

Implements: fyne.Focusable

func (*Entry) FocusLost

func (e *Entry) FocusLost()

FocusLost is called when the Entry has had focus removed.

Implements: fyne.Focusable

func (*Entry) Hide

func (e *Entry) Hide()

Hide hides the entry.

Implements: fyne.Widget

func (*Entry) KeyDown

func (e *Entry) KeyDown(key *fyne.KeyEvent)

KeyDown handler for keypress events - used to store shift modifier state for text selection

Implements: desktop.Keyable

func (*Entry) KeyUp

func (e *Entry) KeyUp(key *fyne.KeyEvent)

KeyUp handler for key release events - used to reset shift modifier state for text selection

Implements: desktop.Keyable

func (*Entry) Keyboard

func (e *Entry) Keyboard() mobile.KeyboardType

Keyboard implements the Keyboardable interface

Implements: mobile.Keyboardable

func (*Entry) MinSize

func (e *Entry) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below.

Implements: fyne.Widget

func (*Entry) MouseDown

func (e *Entry) MouseDown(m *desktop.MouseEvent)

MouseDown called on mouse click, this triggers a mouse click which can move the cursor, update the existing selection (if shift is held), or start a selection dragging operation.

Implements: desktop.Mouseable

func (*Entry) MouseUp

func (e *Entry) MouseUp(m *desktop.MouseEvent)

MouseUp called on mouse release If a mouse drag event has completed then check to see if it has resulted in an empty selection, if so, and if a text select key isn’t held, then disable selecting

Implements: desktop.Mouseable

func (*Entry) SelectedText

func (e *Entry) SelectedText() string

SelectedText returns the text currently selected in this Entry. If there is no selection it will return the empty string.

func (*Entry) SetOnValidationChanged

func (e *Entry) SetOnValidationChanged(callback func(error))

SetOnValidationChanged is intended for parent widgets or containers to hook into the validation. The function might be overwritten by a parent that cares about child validation (e.g. widget.Form).

func (*Entry) SetPlaceHolder

func (e *Entry) SetPlaceHolder(text string)

SetPlaceHolder sets the text that will be displayed if the entry is otherwise empty

func (*Entry) SetText

func (e *Entry) SetText(text string)

SetText manually sets the text of the Entry to the given text value.

func (*Entry) SetValidationError

func (e *Entry) SetValidationError(err error)

SetValidationError manually updates the validation status until the next input change

func (*Entry) Tapped

func (e *Entry) Tapped(ev *fyne.PointEvent)

Tapped is called when this entry has been tapped so we should update the cursor position.

Implements: fyne.Tappable

func (*Entry) TappedSecondary

func (e *Entry) TappedSecondary(pe *fyne.PointEvent)

TappedSecondary is called when right or alternative tap is invoked.

Opens the PopUpMenu with Paste item to paste text from the clipboard.

Implements: fyne.SecondaryTappable

func (*Entry) TypedKey

func (e *Entry) TypedKey(key *fyne.KeyEvent)

TypedKey receives key input events when the Entry widget is focused.

Implements: fyne.Focusable

func (*Entry) TypedRune

func (e *Entry) TypedRune(r rune)

TypedRune receives text input events when the Entry widget is focused.

Implements: fyne.Focusable

func (*Entry) TypedShortcut

func (e *Entry) TypedShortcut(shortcut fyne.Shortcut)

TypedShortcut implements the Shortcutable interface

Implements: fyne.Shortcutable

func (*Entry) Unbind

func (e *Entry) Unbind()

Unbind disconnects any configured data source from this Entry. The current value will remain at the last value of the data source.

Since: 2.0

func (*Entry) Validate

func (e *Entry) Validate() error

Validate validates the current text in the widget