ID:132209
 
Will there be any sort of robust native support for centering the main window?

Thanks
You can just create your own method.

Get the user's screen resolution and position your window accordingly.

winset(src, "window", "size=5000x5000") //window will auto-adjust to your screen's resolution
var
window_res=winget(src, "window", "size") //get the window's resolution, ex: 1000x500
res_width=text2num(copytext(window_res, 1, findtext(window_res, "x"))) //get the first portion of the resolution (1000)
res_height=text2num(copytext(window_res, findtext(window_res, "x") + 1)) //the height portion (500)
winset(src, "window", "size=[WINDOW_WIDTH]x[WINDOW_HEIGHT]; pos=[(res_width - WINDOW_WIDTH) / 2], [(res_height - WINDOW_HEIGHT) / 2]") //center it


A built-in feature would be nice, but not really necessary.
In response to Ruben7
Ruben7 wrote:
You can just create your own method.

Get the user's screen resolution and position your window accordingly.

> winset(src, "window", "size=5000x5000") //window will auto-adjust to your screen's resolution
> var
> window_res=winget(src, "window", "size") //get the window's resolution, ex: 1000x500
> res_width=text2num(copytext(window_res, 1, findtext(window_res, "x"))) //get the first portion of the resolution (1000)
> res_height=text2num(copytext(window_res, findtext(window_res, "x") + 1)) //the height portion (500)
> winset(src, "window", "size=[WINDOW_WIDTH]x[WINDOW_HEIGHT]; pos=[(res_width - WINDOW_WIDTH) / 2], [(res_height - WINDOW_HEIGHT) / 2]") //center it
>

A built-in feature would be nice, but not really necessary.

cool this works (as long as you remove the space after the comma in the pos= part)...

there's a little flash at the beginning (the window resizing)... im sure this is more evident on older slower machines

so yeah like you said, it would be nice to see this as a built-in feature.
In response to FIREking
Set the visibility of the window to false/hidden until you set the position.