diff options
| author | trustable-code <krauter.simon@arcor.de> | 2019-11-08 16:16:00 +0100 |
|---|---|---|
| committer | trustable-code <krauter.simon@arcor.de> | 2019-11-08 16:16:00 +0100 |
| commit | 1c6801c21cf04c738624797710d5938e737b1ca8 (patch) | |
| tree | b32d628b5abab7053a94fd069993ff4a75e3ea0a | |
| parent | 3c2c8db6835f3eb2858631c0c6ae9aab91ca2e44 (diff) | |
| download | NiGui-1c6801c21cf04c738624797710d5938e737b1ca8.tar.gz NiGui-1c6801c21cf04c738624797710d5938e737b1ca8.zip | |
Windows: Raise error when app.init() is called the second time
| -rwxr-xr-x | src/nigui/private/windows/platform_impl.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nigui/private/windows/platform_impl.nim b/src/nigui/private/windows/platform_impl.nim index ef61b89..c1f9790 100755 --- a/src/nigui/private/windows/platform_impl.nim +++ b/src/nigui/private/windows/platform_impl.nim @@ -396,6 +396,8 @@ proc pEnableHighDpiSupport() = fDefaultFontSize = defaultFontSizeForDefaultDpi.scaleToDpi proc init(app: App) = + if pDefaultParentWindow != nil: + raiseError("'app.init()' must not be called a second time.") pInitGdiplus() pEnableVisualStyles() pRegisterWindowClass(pTopLevelWindowClass, pWindowWndProc) @@ -844,7 +846,7 @@ method endPixelDataAccess(image: Image) = proc init(window: WindowImpl) = if pDefaultParentWindow == nil: - raiseError("You need to call 'app.init()' at first.") + raiseError("'app.init()' needs to be called before creating a Window.") var dwStyle: int32 = WS_OVERLAPPEDWINDOW window.fHandle = pCreateWindowExWithUserdata(pTopLevelWindowClass, dwStyle, 0, nil, cast[pointer](window)) DragAcceptFiles(window.fHandle, true) |
