diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-05 03:09:02 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-05 03:09:02 -0400 |
| commit | 125cc7d477835309f7a065817bf8c32e9f6c6f28 (patch) | |
| tree | 884341e7de23ea32f67827011e7fa434a212cd61 /dialog.go | |
| parent | 60f3c1b24f32de0a16c488718980b87fe7c3b55e (diff) | |
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.
Diffstat (limited to 'dialog.go')
| -rw-r--r-- | dialog.go | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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. // The message box will also stay above parent. // 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) { - // 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) } // MsgBoxError displays a message box to the user with just an OK button and an icon indicating an error. // Otherwise, it behaves like MsgBox. 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) } |
