Documentation
¶
Overview ¶
Package alert shows the operating system's modal alert: a message, a row of buttons and, when asked, one line of text to type, cgo-free.
Threading: the alert is platform UI and must be shown from the main thread, as with filedialog; an Ebitengine app wraps the call in ebiten.RunOnMainThread.
Implemented on macOS (NSAlert) and Linux (a GtkDialog, GTK3 or GTK4, joining the GTK the process already loaded). Elsewhere Show returns ErrUnsupported, and the caller keeps a dialog of its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = fmt.Errorf("alert: not supported on this platform: %w", errors.ErrUnsupported)
Functions ¶
This section is empty.
Types ¶
type Button ¶
Button is one choice. Cancel makes Escape choose it; Destructive draws it the platform's way for an action that loses something.
type Options ¶
type Options struct {
Title string
Message string
Buttons []Button
Input bool // show a one-line text field
Text string // what the field starts with
}
Options describes one alert. Buttons go most important first: the first is the default, answered by Return, and the system lays them out (on macOS the first is rightmost).