TL/DR:
Calling window.setActive(false) does not set the window’s active property to false.
Full details:
I have the following ExtJS class inheriting from Ext.window.Window:
Ext.define('WD.view.TbWindow', {
extend : 'Ext.window.Window',
isTbWindow: true,
title: 'Set Me!!',
constrain: true, // constrain window to viewport
autoShow: false,
maximizable: true,
minimizable: true,
renderTo: 'main_panel-body',
minimize: function() {
this.hide();
this.setActive(false);
this.animateTarget.handleWinMinimize();
},
...
});
Within function minimize above there’s the call this.setActive(false);
I use Chrome developer tools to debug the code. Before executing the line this.active is true. After the line is executed it still is true. I’m using ExtJS 4.1.
The problem is with the
Ext.WindowManager.getActive()method. In fact, in the web desktop example the Sencha guys actually do some not-so-nice coding to get the actual active window. I copied that code, and started supporting windows array in my code, and that fixed my issue.I’ve written a (and built extra functionality into) a
DesktopMgrwidget that inherits fromExt.util.MixedCollection, and acts as a “Desktop Manager”, where “Desktop” implies any ExtJS container that is meant to handle multiple windows, activation, deactivation, navigating to the previous/next, etc.You can download and use the
DesktopMgrfrom this gist. Please let me know if you find ways to improve it (or bugs to fix!).