diff options
| author | trustable-code <krauter.simon@arcor.de> | 2017-09-20 20:35:42 +0200 |
|---|---|---|
| committer | trustable-code <krauter.simon@arcor.de> | 2017-09-20 20:35:42 +0200 |
| commit | 17c5e0b4024c5741d22257e706f2af2efb7595ad (patch) | |
| tree | b400d9b4c33accc5dc7d6fd3c061f63f13b3147c /examples | |
| parent | dc62b597a99b8bc1866400366a340347b8fc12b9 (diff) | |
| download | NiGui-17c5e0b4024c5741d22257e706f2af2efb7595ad.tar.gz NiGui-17c5e0b4024c5741d22257e706f2af2efb7595ad.zip | |
Dispose, CloseClick, Minimize
* Changed "Dispose" events
* Added "CloseClick" event
* Added "Window.minimize()" and "Window.minimized"
Use "Window.show()" to unminimize the window.
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/example_05_handle_window_close.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/example_05_handle_window_close.nim b/examples/example_05_handle_window_close.nim index 1f621d6..81ed4de 100755 --- a/examples/example_05_handle_window_close.nim +++ b/examples/example_05_handle_window_close.nim @@ -1,15 +1,17 @@ -# This example shows how to handle a window close request.
+# This example shows how to handle a window close click.
import nigui
-import msgbox
+import nigui/msgbox
app.init()
var window = newWindow()
-window.onDispose = proc(event: WindowDisposeEvent) =
- if window.msgBox("Close the application?", "Close?", "Close", "Abort") != 1:
- event.cancel = true
+window.onCloseClick = proc(event: CloseClickEvent) =
+ case window.msgBox("Do you want to quit?", "Quit?", "Quit", "Minimize", "Cancel")
+ of 1: window.dispose()
+ of 2: window.minimize()
+ else: discard
window.show()
app.run()
|
