Figured out what happens if a message box is created for an invisible window, documented it was undefined (Windows and GTK+ behave reasonably but at least Windows is not documented here; Mac OS X shows a sheet attached to invisible where the titlebar should be and then considers the window closed), and added the panic() checks for uncreated Windows.
This commit is contained in:
parent
60f3c1b24f
commit
125cc7d477
11
dialog.go
11
dialog.go
|
@ -20,15 +20,20 @@ import (
|
||||||
// Attempts to interact with parent will be blocked, but all other Windows in the application can still be used properly.
|
// Attempts to interact with parent will be blocked, but all other Windows in the application can still be used properly.
|
||||||
// The message box will also stay above parent.
|
// The message box will also stay above parent.
|
||||||
// As with parent == nil, resizing is implementation-defined, but will work properly if allowed.
|
// As with parent == nil, resizing is implementation-defined, but will work properly if allowed.
|
||||||
// If parent has not yet been created, MsgBox() panics. [TODO check what happens if hidden]
|
// If parent has not yet been created, MsgBox() panics.
|
||||||
|
// If parent has not been shown yet or is currently hidden, what MsgBox() does is implementation-defined.
|
||||||
func MsgBox(parent *Window, primaryText string, secondaryText string) {
|
func MsgBox(parent *Window, primaryText string, secondaryText string) {
|
||||||
// TODO implement panic after resolving above TODO
|
if parent != nil && !parent.created {
|
||||||
|
panic("parent window passed to MsgBox() before it was created")
|
||||||
|
}
|
||||||
msgBox(parent, primaryText, secondaryText)
|
msgBox(parent, primaryText, secondaryText)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgBoxError displays a message box to the user with just an OK button and an icon indicating an error.
|
// MsgBoxError displays a message box to the user with just an OK button and an icon indicating an error.
|
||||||
// Otherwise, it behaves like MsgBox.
|
// Otherwise, it behaves like MsgBox.
|
||||||
func MsgBoxError(parent *Window, primaryText string, secondaryText string) {
|
func MsgBoxError(parent *Window, primaryText string, secondaryText string) {
|
||||||
// TODO impelment panic after resolving above TODO
|
if parent != nil && !parent.created {
|
||||||
|
panic("parent window passed to MsgBoxError() before it was created")
|
||||||
|
}
|
||||||
msgBoxError(parent, primaryText, secondaryText)
|
msgBoxError(parent, primaryText, secondaryText)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue