Upgrade to v2.5
Fyne API v2.5
package fyne
Animation
AnimationCurve
App
AppMetadata
BuildType
Canvas
CanvasObject
Clipboard
CloudProvider
CloudProviderPreferences
CloudProviderStorage
Container
Delta
Device
DeviceOrientation
Disableable
DoubleTappable
DragEvent
Draggable
Driver
Focusable
HardwareKey
KeyboardShortcut
KeyEvent
KeyModifier
KeyName
Layout
LegacyTheme
Lifecycle
ListableURI
Locale
MainMenu
Menu
MenuItem
Notification
OverlayStack
PointEvent
Position
Preferences
Resource
Scrollable
ScrollEvent
SecondaryTappable
Settings
Shortcut
Shortcutable
ShortcutCopy
ShortcutCut
ShortcutHandler
ShortcutPaste
ShortcutRedo
ShortcutSelectAll
ShortcutUndo
Size
StaticResource
Storage
StringValidator
Tabbable
Tappable
TextAlign
TextStyle
TextTruncation
TextWrap
Theme
ThemeColorName
ThemedResource
ThemeIconName
ThemeSizeName
ThemeVariant
URI
URIReadCloser
URIWithIcon
URIWriteCloser
Validatable
Vector2
Widget
WidgetRenderer
Window
app
canvas
container
data/binding
data/validation
dialog
driver
driver/desktop
driver/mobile
driver/software
lang
layout
storage
storage/repository
test
theme
widget
Fyne API "fyne.Focusable"
fyne.Focusable
import "fyne.io/fyne/v2"
Usage
type Focusable
type Focusable interface {
// FocusGained is a hook called by the focus handling logic after this object gained the focus.
FocusGained()
// FocusLost is a hook called by the focus handling logic after this object lost the focus.
FocusLost()
// TypedRune is a hook called by the input handling logic on text input events if this object is focused.
TypedRune(rune)
// TypedKey is a hook called by the input handling logic on key events if this object is focused.
TypedKey(*KeyEvent)
}
Focusable describes any CanvasObject that can respond to being focused. It will receive the FocusGained and FocusLost events appropriately. When focused it will also have TypedRune called as text is input and TypedKey called when other keys are pressed.
Note: You must not change canvas state (including overlays or focus) in FocusGained or FocusLost or you would end up with a dead-lock.