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

	// Scroll can be used to turn off the scrolling of our entry when Wrapping is WrapNone.
	//
	// Since: 2.4
	Scroll widget.ScrollDirection

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

	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 `json:"-"`
}

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) AcceptsTab

func (e *Entry) AcceptsTab() bool

AcceptsTab returns if Entry accepts the Tab key or not.

Implements: fyne.Tabbable
Since: 2.1

func (*Entry) Append

func (e *Entry) Append(text string)

Append appends the text to the end of the entry.

Since: 2.4

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) Redo

func (e *Entry) Redo()

Redo un-does the last undo action.

Since: 2.5

func (*Entry) Refresh

func (e *Entry) Refresh()

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) SetMinRowsVisible

func (e *Entry) SetMinRowsVisible(count int)

SetMinRowsVisible forces a multi-line entry to show count number of rows without scrolling. This is not a validation or requirement, it just impacts the minimum visible size. Use this carefully as Fyne apps can run on small screens so you may wish to add a scroll container if this number is high. Default is 3.

Since: 2.2

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. Calling SetText resets all undo history.

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. We update the cursor position in device-specific callbacks (MouseDown() and TouchDown()).

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) TouchCancel

func (e *Entry) TouchCancel(*mobile.TouchEvent)

TouchCancel is called when this entry gets a touch cancel event on mobile device (app was removed from focus).

Since: 2.1
Implements: mobile.Touchable

func (*Entry) TouchDown

func (e *Entry) TouchDown(ev *mobile.TouchEvent)

TouchDown is called when this entry gets a touch down event on mobile device, we ensure we have focus.

Since: 2.1
Implements: mobile.Touchable

func (*Entry) TouchUp

func (e *Entry) TouchUp(*mobile.TouchEvent)

TouchUp is called when this entry gets a touch up event on mobile device.

Since: 2.1
Implements: mobile.Touchable

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) Undo

func (e *Entry) Undo()

Undo un-does the last modifying user-action.

Since: 2.5

func (*Entry) Validate

func (e *Entry) Validate() error

Validate validates the current text in the widget.