Skip to content

Instantly share code, notes, and snippets.

@jfjensen
Last active March 15, 2022 12:47
Show Gist options
  • Save jfjensen/890ab273bfef00c726c483aa778c5d6a to your computer and use it in GitHub Desktop.
Save jfjensen/890ab273bfef00c726c483aa778c5d6a to your computer and use it in GitHub Desktop.
Create a button to add an item to the data list
add := widget.NewButton("Add", func() {
w := myApp.NewWindow("Add Data")
itemName := widget.NewEntry()
addData := widget.NewButton("Add", func() {
data.Append(itemName.Text)
w.Close()
})
cancel := widget.NewButton("Cancel", func() {
w.Close()
})
w.SetContent(container.New(layout.NewVBoxLayout(), itemName, addData, cancel))
w.Resize(fyne.NewSize(400, 200))
w.CenterOnScreen()
w.Show()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment