JavaScript
Run Code
Open in Fiddle
Ext.application({ name: 'Fiddle', launch: function () { Ext.create('Ext.window.Window', { title: 'New Window', width: 400, height: 400, bodyPadding: '10 10 10 10', listeners: { focusleave: function (component, event, eOpts) { console.log(event); Ext.Msg.show({ title: 'Confirm Close Window', msg: '<p>You clicked outside the window area and the window will now be closed.</p><p>Any informaiton you have entered will be lost.</p><p>Are you sure?</p>', icons: Ext.Msg.QUESTION, buttons: Ext.Msg.YESNO, fn: function (ans) { console.log(ans); if (ans == 'yes') { component.close(); } else { component.focus(); } } }) } }, items: [{ xtype: 'form', items: [{ xtype: 'textfield', fieldLabel: 'Testing' }, { xtype: 'textfield', fieldLabel: 'Testing' }, { xtype: 'button', text: 'Button' }] }] }).show(); } });