From 40ee93c6fb162ed5c20853060099088e0b568e31 Mon Sep 17 00:00:00 2001 From: trustable-code Date: Thu, 13 Sep 2018 18:18:52 +0200 Subject: Don't use nil for strings any more --- src/nigui/msgbox.nim | 6 +++--- src/nigui/private/windows/platform_impl.nim | 4 ++-- 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) -- cgit v1.2.3