simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
718 stars 50 forks source link

example_01 error #26

Closed matkuki closed 6 years ago

matkuki commented 6 years ago

Hi,

Trying to compile example_01_basic_app.nim and get:

...\.nimble\pkgs\nigui-0.1.0\nigui.nim(951, 41) Error: type mismatch: got <char>
but expected one of:
proc toUpper(c: Rune): Rune
proc toUpper(s: string): string

expression: toUpper(cast[char](unicode))

My specs:

matkuki commented 6 years ago

Changed line 951 in nigui.nim from return cast[int](cast[char](unicode).toUpper) to return cast[int](cast[Rune](unicode).toUpper) and commented out line 66 in nigui/private/windows/platform_impl.nim and it works. Seems like the problem is the recent string implementation change in the compiler.

simonkrauter commented 6 years ago

@matkuki Thx for reporting :)

matkuki commented 6 years ago

@trustable-code Line 66 still needs to be removed! https://github.com/trustable-code/NiGui/blob/master/src/nigui/private/windows/platform_impl.nim#L66

simonkrauter commented 6 years ago

@matkuki Why? I think it's necessary to end the string with two null bytes.

MultiByteToWideChar does not null-terminate an output string... https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx

matkuki commented 6 years ago

@trustable-code With line 66 uncommented the compilation succeeds, but running the executable throws: image commenting out that line makes it work: image Hope it helps.

simonkrauter commented 6 years ago

@matkuki : I have removed the line, thanks for trying out with latest Nim. Next time please open a new issue.

matkuki commented 6 years ago

@trustable-code Great, thanks! Will open a new issue next time 👍