Fyne API "widget.Entry"

widget.Entry


import "fyne.io/fyne/widget"

Usage

type Entry

type Entry struct {
	DisableableWidget

	Text        string
	PlaceHolder string
	OnChanged   func(string) `json:"-"`
	Password    bool
	// Deprecated: Use Disable() instead
	ReadOnly  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 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) 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(_ *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. It does nothing.

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

func (e *Entry) Focused() bool

Focused returns whether or not this Entry has focus.

Implements: fyne.Focusable
Deprecated: this method will be removed as it is no longer required, widgets do not expose their focus state.

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(_ *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) SetReadOnly

func (e *Entry) SetReadOnly(ro bool)

SetReadOnly sets whether or not the Entry should not be editable

Deprecated: Use Disable() instead.

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

func (e *Entry) Validate() error

Validate validates the current text in the widget