PDA

View Full Version : [FIXED-275]Bug/FR? WindowManager.register does not unregister, does not set manager



Animal
28 Sep 2009, 10:45 PM
When those were private, it wasn't a bug, but they are in fact useful methods which may be needed.

I have documented these methods because it may be desirable to move a Window to another manager.

An example is that the Ext.MessageBox Window is in a different manager to the Desktop's Windows in an Ext Desktop application, and so is in a different z-index stack. As found by this poster: http://www.extjs.com/forum/showthread.php?t=81235

The current code (with my newly added comments) is



/**
* <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
* need to be called under normal circumstances. Windows are automatically registered
* with a {@link Ext.Window#manager manager} at construction time.</p>
* <p>Where this may be useful is moving Windows between two WindowManagers. For example,
* to bring the Ext.MessageBox dialog under the same manager as the Desktop's
* WindowManager in the desktop sample app:</p><code><pre>
var msgWin = Ext.MessageBox.getDialog();
Ext.WindowMgr.unregister(msgWin);
MyDesktop.getDesktop().getManager().register(msgWin);
</pre></code>
* @param {Window} win The Window to register.
*/
register : function(win){
list[win.id] = win;
accessList.push(win);
win.on('hide', activateLast);
},

/**
* <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
* need to be called. Windows are automatically unregistered upon destruction.
* However if transferring a Window between two WindowManagers, a Window must first be
* unregistered from its existing manager. See {@link #register}.</p>
* @param {Window} win The Window to unregister.
*/
unregister : function(win){
delete list[win.id];
win.un('hide', activateLast);
accessList.remove(win);
},


It should be



/**
* <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
* need to be called under normal circumstances. Windows are automatically registered
* with a {@link Ext.Window#manager manager} at construction time.</p>
* <p>Where this may be useful is moving Windows between two WindowManagers. For example,
* to bring the Ext.MessageBox dialog under the same manager as the Desktop's
* WindowManager in the desktop sample app:</p><code><pre>
var msgWin = Ext.MessageBox.getDialog();
Ext.WindowMgr.unregister(msgWin);
MyDesktop.getDesktop().getManager().register(msgWin);
</pre></code>
* @param {Window} win The Window to register.
*/
register : function(win){
if (win.manager) {
win.manager.unregister(win);
}
win.manager = this;
list[win.id] = win;
accessList.push(win);
win.on('hide', activateLast);
},

/**
* <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
* need to be called. Windows are automatically unregistered upon destruction.
* However if transferring a Window between two WindowManagers, a Window must first be
* unregistered from its existing manager. See {@link #register}.</p>
* @param {Window} win The Window to unregister.
*/
unregister : function(win){
delete win.manager;
delete list[win.id];
win.un('hide', activateLast);
accessList.remove(win);
},

evant
29 Sep 2009, 9:42 PM
Not really a bug, but it's been added for 3.1.