View Full Version : How to place a miznimized window at the center of the screen?

20 Mar 2015, 1:28 PM
Hello All,

I have a window with the following parameters.

padding: '10',
title : 'Sample Window',
layout: 'fit',
minimizable: true,
maximizable: true,
constrain: true,
width: 1050,
height: 700,
maximized: true,
controller: null,

When the window opens I get a maximized window because of the parameter(maximized: true) that I am using. Now when I click on the restore button of the window, the window gets minimized but the minimized window is appearing at the left corner of the screen. I need to drag the window manually to the center of the screen. Is there a way that when I click on the restore button and the window minimizes, the window will come at the center of the screen?

20 Mar 2015, 4:55 PM

You could listen to the "restore" event on the window, and in the handler call center() on the window to center it. I've included an example below.