Documentation ¶
Overview ¶
Package dialog defines standard dialog windows for application GUIs.
Index ¶
- func ShowColorPicker(title, message string, callback func(c color.Color), parent fyne.Window)
- func ShowConfirm(title, message string, callback func(bool), parent fyne.Window)
- func ShowCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window)
- func ShowCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject, callback func(bool), ...)
- func ShowCustomWithoutButtons(title string, content fyne.CanvasObject, parent fyne.Window)
- func ShowEntryDialog(title, message string, onConfirm func(string), parent fyne.Window)deprecated
- func ShowError(err error, parent fyne.Window)
- func ShowFileOpen(callback func(fyne.URIReadCloser, error), parent fyne.Window)
- func ShowFileSave(callback func(fyne.URIWriteCloser, error), parent fyne.Window)
- func ShowFolderOpen(callback func(fyne.ListableURI, error), parent fyne.Window)
- func ShowForm(title, confirm, dismiss string, content []*widget.FormItem, ...)
- func ShowInformation(title, message string, parent fyne.Window)
- type ColorPickerDialog
- func (d ColorPickerDialog) Hide()
- func (d ColorPickerDialog) MinSize() fyne.Size
- func (p *ColorPickerDialog) Refresh()
- func (d ColorPickerDialog) Resize(size fyne.Size)
- func (p *ColorPickerDialog) SetColor(c color.Color)
- func (d ColorPickerDialog) SetDismissText(label string)
- func (d ColorPickerDialog) SetOnClosed(closed func())
- func (p *ColorPickerDialog) Show()
- type ConfirmDialog
- func (d ConfirmDialog) Hide()
- func (d ConfirmDialog) MinSize() fyne.Size
- func (d ConfirmDialog) Refresh()
- func (d ConfirmDialog) Resize(size fyne.Size)
- func (d *ConfirmDialog) SetConfirmImportance(importance widget.Importance)
- func (d *ConfirmDialog) SetConfirmText(label string)
- func (d ConfirmDialog) SetDismissText(label string)
- func (d ConfirmDialog) SetOnClosed(closed func())
- func (d ConfirmDialog) Show()
- type CustomDialog
- func (d CustomDialog) Hide()
- func (d CustomDialog) MinSize() fyne.Size
- func (d CustomDialog) Refresh()
- func (d CustomDialog) Resize(size fyne.Size)
- func (d *CustomDialog) SetButtons(buttons []fyne.CanvasObject)
- func (d CustomDialog) SetDismissText(label string)
- func (d CustomDialog) SetOnClosed(closed func())
- func (d CustomDialog) Show()
- type Dialog
- type EntryDialogdeprecated
- func (d EntryDialog) Hide()
- func (d EntryDialog) MinSize() fyne.Size
- func (d EntryDialog) Refresh()
- func (d EntryDialog) Resize(size fyne.Size)
- func (d EntryDialog) SetDismissText(label string)
- func (i *EntryDialog) SetOnClosed(callback func())
- func (i *EntryDialog) SetPlaceholder(s string)
- func (i *EntryDialog) SetText(s string)
- func (d EntryDialog) Show()
- type FileDialog
- func (f *FileDialog) Hide()
- func (f *FileDialog) MinSize() fyne.Size
- func (f *FileDialog) Refresh()
- func (f *FileDialog) Resize(size fyne.Size)
- func (f *FileDialog) SetConfirmText(label string)
- func (f *FileDialog) SetDismissText(label string)
- func (f *FileDialog) SetFileName(fileName string)
- func (f *FileDialog) SetFilter(filter storage.FileFilter)
- func (f *FileDialog) SetLocation(u fyne.ListableURI)
- func (f *FileDialog) SetOnClosed(closed func())
- func (f *FileDialog) SetView(v ViewLayout)
- func (f *FileDialog) Show()
- type FormDialog
- type ProgressDialogdeprecated
- func (d ProgressDialog) Hide()
- func (d ProgressDialog) MinSize() fyne.Size
- func (d ProgressDialog) Refresh()
- func (d ProgressDialog) Resize(size fyne.Size)
- func (d ProgressDialog) SetDismissText(label string)
- func (d ProgressDialog) SetOnClosed(closed func())
- func (p *ProgressDialog) SetValue(v float64)
- func (d ProgressDialog) Show()
- type ProgressInfiniteDialogdeprecated
- func (d *ProgressInfiniteDialog) Hide()
- func (d ProgressInfiniteDialog) MinSize() fyne.Size
- func (d ProgressInfiniteDialog) Refresh()
- func (d ProgressInfiniteDialog) Resize(size fyne.Size)
- func (d ProgressInfiniteDialog) SetDismissText(label string)
- func (d ProgressInfiniteDialog) SetOnClosed(closed func())
- func (d ProgressInfiniteDialog) Show()
- type ViewLayout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowColorPicker ¶
ShowColorPicker creates and shows a color dialog. The callback is triggered when the user selects a color.
Since: 1.4
func ShowConfirm ¶
ShowConfirm shows a dialog over the specified window for a user confirmation. The title is used for the dialog window and message is the content. The callback is executed when the user decides.
func ShowCustom ¶
func ShowCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window)
ShowCustom shows a dialog over the specified application using custom content. The button will have the dismiss text set. The MinSize() of the CanvasObject passed will be used to set the size of the window.
func ShowCustomConfirm ¶
func ShowCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject, callback func(bool), parent fyne.Window)
ShowCustomConfirm shows a dialog over the specified application using custom content. The cancel button will have the dismiss text set and the "OK" will use the confirm text. The response callback is called on user action. The MinSize() of the CanvasObject passed will be used to set the size of the window.
func ShowCustomWithoutButtons ¶
func ShowCustomWithoutButtons(title string, content fyne.CanvasObject, parent fyne.Window)
ShowCustomWithoutButtons shows a dialog, wihout buttons, over the specified application using custom content. The MinSize() of the CanvasObject passed will be used to set the size of the window.
Since: 2.4
func ShowEntryDialog
deprecated
func ShowError ¶
ShowError shows a dialog over the specified window for an application error. The message is extracted from the provided error (should not be nil).
func ShowFileOpen ¶
func ShowFileOpen(callback func(fyne.URIReadCloser, error), parent fyne.Window)
ShowFileOpen creates and shows a file dialog allowing the user to choose a file to open. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified.
func ShowFileSave ¶
func ShowFileSave(callback func(fyne.URIWriteCloser, error), parent fyne.Window)
ShowFileSave creates and shows a file dialog allowing the user to choose a file to save to (new or overwrite). If the user chooses an existing file they will be asked if they are sure. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified.
func ShowFolderOpen ¶
func ShowFolderOpen(callback func(fyne.ListableURI, error), parent fyne.Window)
ShowFolderOpen creates and shows a file dialog allowing the user to choose a folder to open. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified.
Since: 1.4
func ShowForm ¶
func ShowForm(title, confirm, dismiss string, content []*widget.FormItem, callback func(bool), parent fyne.Window)
ShowForm shows a dialog over the specified application using the provided FormItems. The cancel button will have the dismiss text set and the confirm button will use the confirm text. The response callback is called on user action after validation passes. If any Validatable widget reports that validation has failed, then the confirm button will be disabled. The initial state of the confirm button will reflect the initial validation state of the items added to the form dialog. The MinSize() of the CanvasObject passed will be used to set the size of the window.
Since: 2.0
func ShowInformation ¶
ShowInformation shows a dialog over the specified window for user information. The title is used for the dialog window and message is the content.
Types ¶
type ColorPickerDialog ¶
type ColorPickerDialog struct { Advanced bool // contains filtered or unexported fields }
ColorPickerDialog is a simple dialog window that displays a color picker.
Since: 1.4
func NewColorPicker ¶
func NewColorPicker(title, message string, callback func(c color.Color), parent fyne.Window) *ColorPickerDialog
NewColorPicker creates a color dialog and returns the handle. Using the returned type you should call Show() and then set its color through SetColor(). The callback is triggered when the user selects a color.
Since: 1.4
func (ColorPickerDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (*ColorPickerDialog) Refresh ¶
func (p *ColorPickerDialog) Refresh()
Refresh causes this dialog to be updated
func (*ColorPickerDialog) SetColor ¶
func (p *ColorPickerDialog) SetColor(c color.Color)
SetColor updates the color of the color picker.
func (ColorPickerDialog) SetDismissText ¶
func (d ColorPickerDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (ColorPickerDialog) SetOnClosed ¶
func (d ColorPickerDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
func (*ColorPickerDialog) Show ¶
func (p *ColorPickerDialog) Show()
Show causes this dialog to be displayed
type ConfirmDialog ¶
type ConfirmDialog struct {
// contains filtered or unexported fields
}
ConfirmDialog is like the standard Dialog but with an additional confirmation button
func NewConfirm ¶
func NewConfirm(title, message string, callback func(bool), parent fyne.Window) *ConfirmDialog
NewConfirm creates a dialog over the specified window for user confirmation. The title is used for the dialog window and message is the content. The callback is executed when the user decides. After creation you should call Show().
func NewCustomConfirm ¶
func NewCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject, callback func(bool), parent fyne.Window) *ConfirmDialog
NewCustomConfirm creates and returns a dialog over the specified application using custom content. The cancel button will have the dismiss text set and the "OK" will use the confirm text. The response callback is called on user action. The MinSize() of the CanvasObject passed will be used to set the size of the window.
func (ConfirmDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (*ConfirmDialog) SetConfirmImportance ¶
func (d *ConfirmDialog) SetConfirmImportance(importance widget.Importance)
SetConfirmImportance sets the importance level of the confirm button.
Since 2.4
func (*ConfirmDialog) SetConfirmText ¶
func (d *ConfirmDialog) SetConfirmText(label string)
SetConfirmText allows custom text to be set in the confirmation button
func (ConfirmDialog) SetDismissText ¶
func (d ConfirmDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (ConfirmDialog) SetOnClosed ¶
func (d ConfirmDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
type CustomDialog ¶
type CustomDialog struct {
// contains filtered or unexported fields
}
CustomDialog implements a custom dialog.
Since: 2.4
func NewCustom ¶
func NewCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window) *CustomDialog
NewCustom creates and returns a dialog over the specified application using custom content. The button will have the dismiss text set. The MinSize() of the CanvasObject passed will be used to set the size of the window.
func NewCustomWithoutButtons ¶
func NewCustomWithoutButtons(title string, content fyne.CanvasObject, parent fyne.Window) *CustomDialog
NewCustomWithoutButtons creates a new custom dialog without any buttons. The MinSize() of the CanvasObject passed will be used to set the size of the window.
Since: 2.4
func (CustomDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (*CustomDialog) SetButtons ¶
func (d *CustomDialog) SetButtons(buttons []fyne.CanvasObject)
SetButtons sets the row of buttons at the bottom of the dialog. Passing an empy slice will result in a dialog with no buttons.
Since: 2.4
func (CustomDialog) SetDismissText ¶
func (d CustomDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (CustomDialog) SetOnClosed ¶
func (d CustomDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
type Dialog ¶
type Dialog interface { Show() Hide() SetDismissText(label string) SetOnClosed(closed func()) Refresh() Resize(size fyne.Size) // Since: 2.1 MinSize() fyne.Size }
Dialog is the common API for any dialog window with a single dismiss button
type EntryDialog
deprecated
type EntryDialog struct { *FormDialog // contains filtered or unexported fields }
EntryDialog is a variation of a dialog which prompts the user to enter some text.
Deprecated: Use dialog.NewForm() or dialog.ShowForm() with a widget.Entry inside instead.
func NewEntryDialog
deprecated
func NewEntryDialog(title, message string, onConfirm func(string), parent fyne.Window) *EntryDialog
NewEntryDialog creates a dialog over the specified window for the user to enter a value.
onConfirm is a callback that runs when the user enters a string of text and clicks the "confirm" button. May be nil.
Deprecated: Use dialog.NewForm() with a widget.Entry inside instead.
func (EntryDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (EntryDialog) SetDismissText ¶
func (d EntryDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (*EntryDialog) SetOnClosed ¶
func (i *EntryDialog) SetOnClosed(callback func())
SetOnClosed changes the callback which is run when the dialog is closed, which is nil by default.
The callback is called unconditionally whether the user confirms or cancels.
Note that the callback will be called after onConfirm, if both are non-nil. This way onConfirm can potential modify state that this callback needs to get the user input when the user confirms, while also being able to handle the case where the user cancelled.
func (*EntryDialog) SetPlaceholder ¶
func (i *EntryDialog) SetPlaceholder(s string)
SetPlaceholder defines the placeholder text for the entry
func (*EntryDialog) SetText ¶
func (i *EntryDialog) SetText(s string)
SetText changes the current text value of the entry dialog, this can be useful for setting a default value.
type FileDialog ¶
type FileDialog struct {
// contains filtered or unexported fields
}
FileDialog is a dialog containing a file picker for use in opening or saving files.
func NewFileOpen ¶
func NewFileOpen(callback func(fyne.URIReadCloser, error), parent fyne.Window) *FileDialog
NewFileOpen creates a file dialog allowing the user to choose a file to open. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified when Show() is called.
func NewFileSave ¶
func NewFileSave(callback func(fyne.URIWriteCloser, error), parent fyne.Window) *FileDialog
NewFileSave creates a file dialog allowing the user to choose a file to save to (new or overwrite). If the user chooses an existing file they will be asked if they are sure. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified when Show() is called.
func NewFolderOpen ¶
func NewFolderOpen(callback func(fyne.ListableURI, error), parent fyne.Window) *FileDialog
NewFolderOpen creates a file dialog allowing the user to choose a folder to open. The callback function will run when the dialog closes. The URI will be nil when the user cancels or when nothing is selected.
The dialog will appear over the window specified when Show() is called.
Since: 1.4
func (*FileDialog) MinSize ¶
func (f *FileDialog) MinSize() fyne.Size
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (*FileDialog) Refresh ¶
func (f *FileDialog) Refresh()
Refresh causes this dialog to be updated
func (*FileDialog) Resize ¶
func (f *FileDialog) Resize(size fyne.Size)
Resize dialog to the requested size, if there is sufficient space. If the parent window is not large enough then the size will be reduced to fit.
func (*FileDialog) SetConfirmText ¶
func (f *FileDialog) SetConfirmText(label string)
SetConfirmText allows custom text to be set in the confirmation button
Since: 2.2
func (*FileDialog) SetDismissText ¶
func (f *FileDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button
func (*FileDialog) SetFileName ¶
func (f *FileDialog) SetFileName(fileName string)
SetFileName sets the filename in a FileDialog in save mode. This is normally called before the dialog is shown.
func (*FileDialog) SetFilter ¶
func (f *FileDialog) SetFilter(filter storage.FileFilter)
SetFilter sets a filter for limiting files that can be chosen in the file dialog.
func (*FileDialog) SetLocation ¶
func (f *FileDialog) SetLocation(u fyne.ListableURI)
SetLocation tells this FileDialog which location to display. This is normally called before the dialog is shown.
Since: 1.4
func (*FileDialog) SetOnClosed ¶
func (f *FileDialog) SetOnClosed(closed func())
SetOnClosed sets a callback function that is called when the dialog is closed.
func (*FileDialog) SetView ¶
func (f *FileDialog) SetView(v ViewLayout)
SetView changes the default display view of the FileDialog This is normally called before the dialog is shown.
Since: 2.5
type FormDialog ¶
type FormDialog struct {
// contains filtered or unexported fields
}
FormDialog is a simple dialog window for displaying FormItems inside a form.
Since: 2.4
func NewForm ¶
func NewForm(title, confirm, dismiss string, items []*widget.FormItem, callback func(bool), parent fyne.Window) *FormDialog
NewForm creates and returns a dialog over the specified application using the provided FormItems. The cancel button will have the dismiss text set and the confirm button will use the confirm text. The response callback is called on user action after validation passes. If any Validatable widget reports that validation has failed, then the confirm button will be disabled. The initial state of the confirm button will reflect the initial validation state of the items added to the form dialog.
Since: 2.0
func (FormDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (FormDialog) SetDismissText ¶
func (d FormDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (FormDialog) SetOnClosed ¶
func (d FormDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
func (*FormDialog) Submit ¶
func (d *FormDialog) Submit()
Submit will submit the form and then hide the dialog if validation passes.
Since: 2.4
type ProgressDialog
deprecated
type ProgressDialog struct {
// contains filtered or unexported fields
}
ProgressDialog is a simple dialog window that displays text and a progress bar.
Deprecated: Use NewCustomWithoutButtons() and add a widget.ProgressBar() inside.
func NewProgress
deprecated
func NewProgress(title, message string, parent fyne.Window) *ProgressDialog
NewProgress creates a progress dialog and returns the handle. Using the returned type you should call Show() and then set its value through SetValue().
Deprecated: Use NewCustomWithoutButtons() and add a widget.ProgressBar() inside.
func (ProgressDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (ProgressDialog) SetDismissText ¶
func (d ProgressDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (ProgressDialog) SetOnClosed ¶
func (d ProgressDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
func (*ProgressDialog) SetValue ¶
func (p *ProgressDialog) SetValue(v float64)
SetValue updates the value of the progress bar - this should be between 0.0 and 1.0.
type ProgressInfiniteDialog
deprecated
type ProgressInfiniteDialog struct {
// contains filtered or unexported fields
}
ProgressInfiniteDialog is a simple dialog window that displays text and a infinite progress bar.
Deprecated: Use NewCustomWithoutButtons() and add a widget.ProgressBarInfinite() inside.
func NewProgressInfinite
deprecated
func NewProgressInfinite(title, message string, parent fyne.Window) *ProgressInfiniteDialog
NewProgressInfinite creates a infinite progress dialog and returns the handle. Using the returned type you should call Show().
Deprecated: Use NewCustomWithoutButtons() and add a widget.ProgressBarInfinite() inside.
func (*ProgressInfiniteDialog) Hide ¶
func (d *ProgressInfiniteDialog) Hide()
Hide this dialog and stop the infinite progress goroutine
func (ProgressInfiniteDialog) MinSize ¶
MinSize returns the size that this dialog should not shrink below
Since: 2.1
func (ProgressInfiniteDialog) SetDismissText ¶
func (d ProgressInfiniteDialog) SetDismissText(label string)
SetDismissText allows custom text to be set in the dismiss button This is a no-op for dialogs without dismiss buttons.
func (ProgressInfiniteDialog) SetOnClosed ¶
func (d ProgressInfiniteDialog) SetOnClosed(closed func())
SetOnClosed allows to set a callback function that is called when the dialog is closed
type ViewLayout ¶
type ViewLayout int
ViewLayout can be passed to SetView() to set the view of a FileDialog
Since: 2.5
const ( ListView ViewLayout GridView )