Using common dialogs
During the user’s journey of an application, you will often need to interrupt the flow to present information, ask the user for confirmation, or to pick a file or other input element. For this purpose, toolkits usually provide dialog windows, and Fyne does the same. Instead of opening a new window, the dialogs will appear over existing content in the current window (which works well across all platforms as not all manage multiple window applications well).
Each dialog has its own constructor function (of the dialog.NewXxx()
form) that create the dialog to be shown later using Show()
. They also provide a helper function to create and show it (of the dialog.ShowXxx()
form). The last parameter of all these functions is the window that they should be displayed in. All the dialogs also support setting a callback when the dialog closes. This can be configured using the SetOnClosed()
method.
In this section, we looked at the different dialog helpers that...