44 lines
877 B
Go
44 lines
877 B
Go
package main
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/app"
|
|
"fyne.io/fyne/v2/container"
|
|
"fyne.io/fyne/v2/widget"
|
|
)
|
|
|
|
func main() {
|
|
myApp := app.New()
|
|
window := myApp.NewWindow("Hello World.")
|
|
window.Resize(fyne.NewSize(700, 400))
|
|
// window.SetFixedSize(true)
|
|
|
|
textEntry := widget.NewMultiLineEntry()
|
|
textEntry.Wrapping = fyne.TextWrapWord
|
|
// textEntry.Disable()
|
|
|
|
initialText := "This is text"
|
|
textEntry.SetText(initialText)
|
|
textEntry.OnChanged = func(text string) {
|
|
if text != initialText {
|
|
textEntry.SetText(initialText)
|
|
}
|
|
}
|
|
|
|
button := widget.NewButton(" [ Close ] ", func() {
|
|
myApp.Quit()
|
|
})
|
|
|
|
content := container.NewBorder(
|
|
nil, // top
|
|
container.NewBorder(nil, nil, nil, button, nil), // bottom
|
|
nil, // left
|
|
nil, // right
|
|
textEntry, // center
|
|
)
|
|
|
|
window.SetContent(content)
|
|
window.CenterOnScreen()
|
|
window.ShowAndRun()
|
|
}
|