Select Entry Dropdown Advance – Fyne Golang GUI tutorial 69
Select Entry Dropdown Advance – Fyne Golang GUI tutorial 69
package main // import fyne import ( "fmt" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/widget" ) func main() { // new app a := app.New() // new title and window w := a.NewWindow("Select Entry - DropDown advance") // resize window w.Resize(fyne.NewSize(400, 400)) // lets create a label label1 := widget.NewLabel("...") // newselectentry widget // []string{} it take only slice of option //& you can your options also in run time. Not hardcoded select_entry := widget.NewSelectEntry([]string{"peshawar", "multan", "gujrat", "kabul", "dehli"}) // what to do with the selected entry ? // here is what we are going to define select_entry.OnSubmitted = func(s string) { fmt.Printf("my city %s is awesome", s) // update label with our values label1.Text = s label1.Refresh() } // container .. we have more than one widgets c := container.NewVBox( label1, select_entry, ) w.SetContent(c) w.ShowAndRun() }[easy_media_download url=”http://blogvali.com/wp-content/uploads/fyne-golang-downloads/main56.go” text=”Download Code” color=”red_darker”]