-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
controlgallery.nim fails with "object.nim(37, 78) Error: invalid indentation" #28
Comments
I haven't had time to test this, but looking at that line I believe it is the pragma syntax which has gotten stricter. If you move the |
This is the line: But I tried with WxObjectDataPtr*[T] and actually the compilation goes on, it stops after some other lines: |
Yes, that's what I meant by right after the |
I tried to compile controlgallary and it stops at line 65 of object.nim with "Error: undeclared identifier: 'WxClassInfo'" |
It actually makes perfect sense. In Nim After having fixed that and a couple more misplaced generics in the code I managed to get further in compiling. However I hit a dead end at the "implicitDeref" experimental pragma which was removed in Nim 2.0.0. This is unfortunate as it requires a rewrite of this library to be functional again. However I have pushed my changes as they are backwards compatible with 1.6.18, which still compiles this just fine (and is still supported). |
Ok, I misunderstood your previous post. Yes, it has perfect sense, the object works only when included. Thanks for your work on this Library if you succeed in making it work again I can help you in some way testing it. I want to learn nim coding a small interface with WebView and wxwidget. |
I mean you can just run |
Ok, it works. Thank you for suggesting the use of choosenim, now I have two version of nim installed and I can switch very easy from one to the other. (I have to understand where both are installed ) |
I tried the examples, with genui and without. How can I rewrite it using genui or purewx? |
For purewx it should be pretty much the same, just convert the syntax to Nim. For genui I believe something like this would be what you're looking for: # NOTE: these imports are relative to this folder, this would not be required if wxnim was installed with Nimble
import "../../wxnim/wx", "../../wxnim/genui"
# Experimental is required for now, this will become default later
{.experimental: "implicitDeref".}
# Generate the GUI
genui:
mainFrame % Frame(title = "Hello World"):
Panel | Gridsizer(3, 3, 0, 0):
Button[flag = wxAlignCenter]: "Avvia"
# Show the main frame and run the main loop
mainFrame.show()
runMainLoop() As you can see you use the |
By the way, you can pass |
Thank you, I can watch the macro expanded. |
By the way, I have just installed wxformbuilder, it seems better that wglade and it can export python, cpp and lua. |
You can just do the same thing in WxNim: # NOTE: these imports are relative to this folder, this would not be required if wxnim was installed with Nimble
import "../../wxnim/wx", "../../wxnim/genui"
# Experimental is required for now, this will become default later
{.experimental: "implicitDeref".}
# Generate the GUI
genui:
mainFrame % Frame(title = "Hello World"):
panel % Panel | Gridsizer(3, 3, 0, 0)
panel.getSizer.add(0, 0, 0, 0)
panel.getSizer.add(0, 0, 0, 0)
panel.getSizer.add(0, 0, 0, 0)
panel.getSizer.add(0, 0, 0, 0)
panel.addElements:
Button[flag = wxAlignCenter]: "Button"
# Show the main frame and run the main loop
mainFrame.show()
runMainLoop() Of course you could've just added some As for wxformbuilder/wxglade I have no idea, never used either of them. |
Thanks! |
Did you read the explanation of the genui macro in the README? https://github.com/PMunch/wxnim?tab=readme-ov-file#the-genui-macro Basically the genui macro here is run, and creates a frame and a panel with a sizer. The frame is assigned to the variable Then outside the genui macro we use the |
Thank you very much. I started to read the explanation in Readme and now I can understand almost everything. If I need some other hint I will contact you. But it seems that the Readme is enough for what I have intention to do. |
Great to hear, if you make it open source I'd be very interested to see what you make with this! |
Probably you overrate my skills. The app I coded at now is a small panel with three buttons. I need it to launch chrome to browse a local httpd in nim which serves html pages dynamicaly generated with the list of directories full of documents. But you may be interested to know that the panel with three buttons in wxnim needs 36 rows of code, in cpp 138. Your macros are very powerful. |
Here I am again. I tried very hard to got webview functioning, as an exercise to improve my understanding of the whole nim and c. In short:
|
I have followed the instructions in Readme: cd examples/genuimacro nim cpp -r controlgallery.nim but the compiler exits with this wxnim-master/wxnim/private/object.nim(37, 78) Error: invalid indentation
I tried to edit the code, re-enter the indentation as tab (not allowed) and as spaces (2 or 3), nothing works. I think I am missing something about nim syntax.
The text was updated successfully, but these errors were encountered: