From b227a0aabd65159cbee53db50d5814cab208e652 Mon Sep 17 00:00:00 2001 From: Ragin666 Date: Sat, 27 Jun 2020 20:24:43 +0200 Subject: [PATCH 1/2] Fixes https://github.com/fyne-io/fyne/issues/1143 This method requires a callback. To call a callback it is necessary to set sendResponse to true. Else dialog.hideWithResponse() will not call the callback. --- dialog/base.go | 1 + 1 file changed, 1 insertion(+) diff --git a/dialog/base.go b/dialog/base.go index 1e95be5f0e..a1743577a2 100644 --- a/dialog/base.go +++ b/dialog/base.go @@ -186,6 +186,7 @@ func NewCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject, callback func(bool), parent fyne.Window) Dialog { d := &dialog{content: content, title: title, icon: nil, parent: parent} d.callback = callback + d.sendResponse = true d.dismiss = &widget.Button{Text: dismiss, Icon: theme.CancelIcon(), OnTapped: d.Hide, From a4e589ec964b87017b1cf3a04421122c1250ecd8 Mon Sep 17 00:00:00 2001 From: Ragin666 Date: Sat, 27 Jun 2020 23:06:36 +0200 Subject: [PATCH 2/2] Fixes https://github.com/fyne-io/fyne/issues/1143 Adding TODO because of discussion on Slack --- dialog/base.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dialog/base.go b/dialog/base.go index a1743577a2..d1e99c68a2 100644 --- a/dialog/base.go +++ b/dialog/base.go @@ -186,6 +186,9 @@ func NewCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject, callback func(bool), parent fyne.Window) Dialog { d := &dialog{content: content, title: title, icon: nil, parent: parent} d.callback = callback + // TODO: This is required to avoid confusion. + // Normally this function should only provide the dialog, but currently it is also displayed, which is wrong. + // For this case the ShowCustomConfirm() method was built. d.sendResponse = true d.dismiss = &widget.Button{Text: dismiss, Icon: theme.CancelIcon(),