webui-dev / nim-webui

Use any web browser as GUI, with Nim in the backend and HTML5 in the frontend.
https://webui.me
MIT License
130 stars 9 forks source link

Get and set window size & position #25

Closed runrc closed 8 months ago

runrc commented 10 months ago

It would be very useful if we could get and set the window size and position. Can we expect this functionality to be available soon?

hassandraga commented 10 months ago

Set window size already exists in the main library, while getting window size can be done by running a script. Someone needs to add this to the Nim wrapper.

webui_set_size(myWindow, 800, 600);
webui_set_position(myWindow, 100, 100);
runrc commented 10 months ago

I believe the get/set position bindings have already been added to the main branch. Unfortunately, I get the following build error(s) when trying to build the examples.

% git clone --recursive https://github.com/webui-dev/nim-webui
% cd nim-webui/examples
% nim r minimal.nim
Hint: used config file '/opt/homebrew/Cellar/nim/2.0.0_1/nim/config/nim.cfg' [Conf]
Hint: used config file '/opt/homebrew/Cellar/nim/2.0.0_1/nim/config/config.nims' [Conf]
Hint: used config file '/Users/runrc/dev/webui/examples/nim.cfg' [Conf]
..............................................................................................................
/Users/runrc/dev/webui/webui.nim(118, 15) Error: undeclared field: 'data'

Having the ability to set the window position would be very useful. Unfortunately, I'm not 100% proficient with Nim, so any help in fixing this error would be helpful?

neroist commented 8 months ago

I've updated the bindings & wrapper, this should be fixed.