diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-08 08:50:52 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-08 08:50:52 -0400 |
| commit | 641d11c6fea7f7189329e5bdc05871f6a984f40b (patch) | |
| tree | b4b20dfcab5fc65213105d4308ce314a69774374 /dialog.go | |
| parent | 7cb8fc1e324c6c6c2717d169bc928717c5c44198 (diff) | |
Implemented the new MsgBox()/MsgBoxError() behavior on Windows.
Diffstat (limited to 'dialog.go')
| -rw-r--r-- | dialog.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -19,7 +19,7 @@ var dialogWindow *Window // Whether or not resizing Windows will still be allowed is implementation-defined; if the implementation does allow it, resizes will still work properly. // Whether or not the message box stays above all other W+indows in the program is also implementation-defined. func MsgBox(primaryText string, secondaryText string) { - dialogWindow.msgBox(parent, primaryText, secondaryText) + <-dialogWindow.msgBox(primaryText, secondaryText) } // MsgBox behaves like the package-scope MsgBox function, except the message box is modal to w only. @@ -28,24 +28,26 @@ func MsgBox(primaryText string, secondaryText string) { // Whether w can be resized while the message box is displayed is implementation-defined, but will work properly if allowed. // If w has not yet been created, MsgBox() panics. // If w has not been shown yet or is currently hidden, what MsgBox does is implementation-defined. -func (w *Window) MsgBox(primaryText string, secondaryText string) { +// +// On return, done will be a channel that is pulsed when the message box is dismissed. +func (w *Window) MsgBox(primaryText string, secondaryText string) (done chan struct{}) { if !w.created { panic("parent window passed to Window.MsgBox() before it was created") } - w.msgBox(primaryText, secondaryText) + return w.msgBox(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(primaryText string, secondaryText string) { - dialogWindow.msgBoxError(parent, primaryText, secondaryText) + <-dialogWindow.msgBoxError(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 Window.MsgBox. -func (w *Window) MsgBoxError(primaryText string, secondaryText string) { +func (w *Window) MsgBoxError(primaryText string, secondaryText string) (done chan struct{}) { if !w.created { panic("parent window passed to MsgBoxError() before it was created") } - w.msgBoxError(primaryText, secondaryText) + return w.msgBoxError(primaryText, secondaryText) } |
