diff options
| author | trustable-code <krauter.simon@arcor.de> | 2017-07-01 14:24:18 +0200 |
|---|---|---|
| committer | trustable-code <krauter.simon@arcor.de> | 2017-07-01 14:24:18 +0200 |
| commit | 59aa41ad707a814ea7145248c52f6f16b1c895d3 (patch) | |
| tree | d70c2142f2c9063e938af31b13e8a0eb79a5dc60 /examples/example_04_msgboxes.nim | |
| download | NiGui-59aa41ad707a814ea7145248c52f6f16b1c895d3.tar.gz NiGui-59aa41ad707a814ea7145248c52f6f16b1c895d3.zip | |
first public preview version
Diffstat (limited to 'examples/example_04_msgboxes.nim')
| -rwxr-xr-x | examples/example_04_msgboxes.nim | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/example_04_msgboxes.nim b/examples/example_04_msgboxes.nim new file mode 100755 index 0000000..eca30a6 --- /dev/null +++ b/examples/example_04_msgboxes.nim @@ -0,0 +1,37 @@ +# This example shows different methods to create message boxes. + +import nigui +import msgbox + +app.init() + +var window = newWindow() +var mainContainer = newLayoutContainer(Layout_Vertical) +window.add(mainContainer) + +var buttons = newLayoutContainer(Layout_Horizontal) +mainContainer.add(buttons) + +var textArea = newTextArea() +mainContainer.add(textArea) + +var button1 = newButton("Example 1") +buttons.add(button1) +button1.onClick = proc(event: ClickEvent) = + window.alert("Hello.\n\nThis message box is created with \"alert()\".") + textArea.addLine("Message box closed") + +var button2 = newButton("Example 2") +buttons.add(button2) +button2.onClick = proc(event: ClickEvent) = + let res = window.msgBox("Hello.\n\nThis message box is created with \"msgBox()\".") + textArea.addLine("Message box closed, result = " & $res) + +var button3 = newButton("Example 3") +buttons.add(button3) +button3.onClick = proc(event: ClickEvent) = + let res = window.msgBox("Hello.\n\nThis message box is created with \"msgBox()\" and has three buttons.", "Title of message box", "Button 1", " Button 2", "Button 3") + textArea.addLine("Message box closed, result = " & $res) + +window.show() +app.run() |
