When I double click on the packaged executable on OS X, the initial window seems to always open at the lower left corner of the window. Is there a way to open it at the center of the screen and to customize the dimension of the main window? Thanks.
Printable View
When I double click on the packaged executable on OS X, the initial window seems to always open at the lower left corner of the window. Is there a way to open it at the center of the screen and to customize the dimension of the main window? Thanks.
The recommended approach is to keep the window hidden (have autoShow be false) and then you can set up the window dimensions and position prior to calling show() for the first time. Something like this:
Code:var win = Ion.ui.mainWindow;
win.setDimensions(1024, 768);
win.center();
win.show();
Thanks @jarrednicholls. Is it possible to make it the default behavior, or to make it configurable in the packager json file? My reason is that I want to minimize the dependencies on the ion api. I'm hoping to share as much code as possible with my browser version.
Thanks.
Unfortunately not at this time, the autoShow is the only option available in the mainWindow settings. We have intentions to extend the mainWindow settings however for sure. I'll attach this thread to a ticket so it can be tracked.
In the meantime, you can use the common web tactic of feature detection to detect if Ion API is present, and if so, take advantage of it. Your code will be portable and adaptable...this is extremely common and happens in every web application, so don't think of this as being "hacky"...it's deliberate.
Thanks!Code:if (typeof window.Ion !== 'undefined') {
var win = Ion.ui.mainWindow;
win.setDimensions(1024, 768);
win.center();
win.show();
}