Documentation ¶
Overview ¶
Package modal defines modals for the Fyne GUI toolkit.
Modals ¶
Modals are similar to Fyne dialogs, but do not require user interaction. They are useful when you have a longer running process that the user needs to wait for before he can continue. e.g. opening a large file.
Progress modals ¶
Progress modals are modals that show a progress indicator while an action function is running. The are several variant, which all share a similar API:
- Title and message
- Action function callback that return an error
- Callback hooks for success and error, e.g. to inform the user about an error
- Start() method is called to start the action
Note that the action function will always be run as a goroutine.
A progress modal can be used similar to Fyne dialogs:
m := kxmodal.NewProgressInfinite("Loading file", "Loading file XX. Please wait.", func() error { time.Sleep(3 * time.Second) // simulate a long running process return nil }, w) m.Start()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressCancelModal ¶
type ProgressCancelModal struct { // Optional callback when the action failed. OnError func(err error) // Optional callback when the action succeeded. OnSuccess func() // contains filtered or unexported fields }
ProgressCancelModal is a modal that shows a progress indicator while a function is running. The progress indicator is updated by the function.
func NewProgressWithCancel ¶
func NewProgressWithCancel(title, message string, action func(progress binding.Float, canceled chan struct{}) error, max float64, parent fyne.Window) *ProgressCancelModal
NewProgress returns a new ProgressModal instance.
func (*ProgressCancelModal) Start ¶
func (m *ProgressCancelModal) Start()
Start starts the action function and shows the modal while it is running.
type ProgressInfiniteCancelModal ¶
type ProgressInfiniteCancelModal struct { // Optional callback when the action failed. OnError func(err error) // Optional callback when the action succeeded. OnSuccess func() // contains filtered or unexported fields }
ProgressInfiniteCancelModal is a modal that shows an infinite progress indicator while a function is running. The modal has a button for canceling the function.
func NewProgressInfiniteWithCancel ¶
func NewProgressInfiniteWithCancel( title, message string, action func(canceled chan struct{}) error, parent fyne.Window, ) *ProgressInfiniteCancelModal
NewProgressInfiniteWithCancel returns a new ProgressInfiniteCancelModal instance. The action function needs to check the canceled channel and abort if it is closed.
func (*ProgressInfiniteCancelModal) Start ¶
func (m *ProgressInfiniteCancelModal) Start()
Start starts the action function and shows the modal while it is running.
type ProgressInfiniteModal ¶
type ProgressInfiniteModal struct { // Optional callback when the action failed. OnError func(err error) // Optional callback when the action succeeded. OnSuccess func() // contains filtered or unexported fields }
ProgressInfiniteModal is a modal that shows an infinite progress indicator while a function is running.
func NewProgressInfinite ¶
func NewProgressInfinite(title, message string, action func() error, parent fyne.Window) *ProgressInfiniteModal
NewProgressInfinite returns a new ProgressInfiniteModal instance.
func (*ProgressInfiniteModal) Start ¶
func (m *ProgressInfiniteModal) Start()
Start starts the action function and shows the modal while it is running.
type ProgressModal ¶
type ProgressModal struct { // Optional callback when the action failed. OnError func(err error) // Optional callback when the action succeeded. OnSuccess func() // contains filtered or unexported fields }
ProgressModal is a modal that shows a progress indicator while an action function is running. The progress indicator must be updated by the action function.
func NewProgress ¶
func NewProgress(title, message string, action func(progress binding.Float) error, max float64, parent fyne.Window) *ProgressModal
NewProgress returns a new ProgressModal instance.
func (*ProgressModal) Start ¶
func (m *ProgressModal) Start()
Start starts the action function and shows the modal while it is running.