summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrustable-code <krauter.simon@arcor.de>2018-09-13 18:18:52 +0200
committertrustable-code <krauter.simon@arcor.de>2018-09-13 18:18:52 +0200
commit40ee93c6fb162ed5c20853060099088e0b568e31 (patch)
tree70f293e36ba4cf639c3f837388ba61ee5376d9f9 /src
parent60ed2b53fe9332c02a3f927f8a8274734a6c7f5b (diff)
downloadNiGui-40ee93c6fb162ed5c20853060099088e0b568e31.tar.gz
NiGui-40ee93c6fb162ed5c20853060099088e0b568e31.zip
Don't use nil for strings any more
Diffstat (limited to 'src')
-rwxr-xr-xsrc/nigui/msgbox.nim6
-rwxr-xr-xsrc/nigui/private/windows/platform_impl.nim4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/nigui/msgbox.nim b/src/nigui/msgbox.nim
index 5071dfb..c955c03 100755
--- a/src/nigui/msgbox.nim
+++ b/src/nigui/msgbox.nim
@@ -20,7 +20,7 @@ proc buttonClick(event: ClickEvent) =
cast[MessageBoxWindow](event.control.parentWindow).clickedButton = cast[Button](event.control)
event.control.parentWindow.dispose()
-proc msgBox*(parent: Window, message: string, title = "Message", button1 = "OK", button2, button3: string = nil): int {.discardable.} =
+proc msgBox*(parent: Window, message: string, title = "Message", button1 = "OK", button2, button3: string = ""): int {.discardable.} =
const buttonMinWidth = 100
var window = new MessageBoxWindow
window.init()
@@ -50,13 +50,13 @@ proc msgBox*(parent: Window, message: string, title = "Message", button1 = "OK",
b1.onClick = buttonClick
buttonContainer.add(b1)
- if button2 != nil:
+ if button2 != "":
b2 = newButton(button2)
b2.minWidth = buttonMinWidth
b2.onClick = buttonClick
buttonContainer.add(b2)
- if button3 != nil:
+ if button3 != "":
b3 = newButton(button3)
b3.minWidth = buttonMinWidth
b3.onClick = buttonClick
diff --git a/src/nigui/private/windows/platform_impl.nim b/src/nigui/private/windows/platform_impl.nim
index 36c262a..fbc833a 100755
--- a/src/nigui/private/windows/platform_impl.nim
+++ b/src/nigui/private/windows/platform_impl.nim
@@ -446,14 +446,14 @@ method run*(dialog: OpenFileDialog) =
ofn.lpstrFile = s
let ret = GetOpenFileNameW(ofn)
if ret:
- var dirOrFirstFile: string
+ var dirOrFirstFile = ""
# Split selected file names:
while s[0].ord != 0:
var i = 0
while i < s.len - 1 and s[i].ord != 0:
i.inc(2)
let filename = s.substr(0, i - 1).pUtf16ToUtf8()
- if dirOrFirstFile == nil:
+ if dirOrFirstFile == "":
dirOrFirstFile = filename
else:
dialog.files.add(dirOrFirstFile / filename)