Skip to content

Commit

Permalink
do not call callback on cancel
Browse files Browse the repository at this point in the history
When user cancel the dialog the callback should not be called especially when submit/cancel event can't be delivered.
  • Loading branch information
zdima committed Nov 1, 2023
1 parent c29a062 commit 0fdb38e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dialog/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func (i *EntryDialog) SetOnClosed(callback func()) {
func NewEntryDialog(title, message string, onConfirm func(string), parent fyne.Window) *EntryDialog {
i := &EntryDialog{entry: widget.NewEntry()}
items := []*widget.FormItem{widget.NewFormItem(message, i.entry)}
i.formDialog = NewForm(title, "Ok", "Cancel", items, func(_ bool) {
i.formDialog = NewForm(title, "Ok", "Cancel", items, func(confirm bool) {
// User has confirmed and entered an input
if onConfirm != nil {
if confirm && onConfirm != nil {
onConfirm(i.entry.Text)
}

Expand Down

0 comments on commit 0fdb38e

Please sign in to comment.