Skip to content

Commit

Permalink
Only init the dropdown once
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Oct 7, 2020
1 parent bbad6d7 commit 08011d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion widget/select_entry.go
Expand Up @@ -16,6 +16,8 @@ type SelectEntry struct {
func NewSelectEntry(options []string) *SelectEntry {
e := &SelectEntry{}
e.ExtendBaseWidget(e)

e.ActionItem = e.setupDropDown()
e.SetOptions(options)
return e
}
Expand Down Expand Up @@ -53,6 +55,9 @@ func (e *SelectEntry) SetOptions(options []string) {
items = append(items, fyne.NewMenuItem(option, func() { e.SetText(option) }))
}
e.dropDown = fyne.NewMenu("", items...)
}

func (e *SelectEntry) setupDropDown() fyne.CanvasObject {
dropDownButton := NewButton("", func() {
c := fyne.CurrentApp().Driver().CanvasForObject(e.super())

Expand All @@ -65,5 +70,5 @@ func (e *SelectEntry) SetOptions(options []string) {
})
dropDownButton.HideShadow = true
dropDownButton.SetIcon(theme.MenuDropDownIcon())
e.ActionItem = dropDownButton
return dropDownButton
}

0 comments on commit 08011d7

Please sign in to comment.