simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
724 stars 49 forks source link

how to get the window pos and size? #82

Closed mark-summerfield closed 4 years ago

mark-summerfield commented 4 years ago

I have a Window and can set its width and height. But when I try to get is position or size, e.g., let x = mainwindow.x I get an error:

config.nim(65, 24) Error: undeclared field: 'x' for type nigui.Window [declared in /home/mark/.nimble/pkgs/nigui-0.2.2/nigui.nim(215, 3)] 

What puzzles me is that x does appear to be a public field. I'd like to be able to get/set the size and pos so that I can load/save them for the user.

simonkrauter commented 4 years ago

This works for me unter Linux and Windows:

var window = newWindow()
window.x = window.x + 20

Can you show a small program to reproduce the error?

mark-summerfield commented 4 years ago

As your small program shows, a small program doesn't produce the error. I plan to release a game written in pure nim/nigui with the load/save of window size/pos commented out (since it exhibits this bug) and I'll try to remember to add a link to it then.

mark-summerfield commented 4 years ago

Sorry, it was my bug not yours.