Search code examples
tidesdk

Position window to the bottom right of the window?


How do I Position window to the bottom right of the window? I was thinking getting the max width and max height of the user's screen then subtracting a few pixels but I don't know how to do that.


Solution

  • You can use the screen size (window.screen.width and window.screen.height) and the window size to calculate the wanted position of the top left corner of the window, and then place it there:

    var app_window=Ti.UI.getCurrentWindow();
    app_window.setX(window.screen.width-app_window.getWidth());
    app_window.setY(window.screen.height-app_window.getHeight());