-
26 Nov 2008 10:50 AM #1
howt to get all windows from WindowManager
howt to get all windows from WindowManager
I would like to get a list of all windows from the windowmanager.
just for debugging purpose, to check if there are any windows still registered (which shouldn't be).
I think I could just listen to the Register and Unregister actions and maintain another list with the windows.
But this would be a completely redundant list, so:
would it make sense to add a method to the WindowManger that returns a list of the registered windows (maybe an unmodifiable list)?
or is there a better way to do this?
-
23 Jul 2009 10:33 AM #2
I just thought I'd add to this thread since there doesn't seem to be a solution available on the forums yet.
EDIT: THIS IS FOR EXTJS. I DID NOT REALIZE THIS WAS THE GXT FORUM WHEN I POSTED IT.
I just used the each() method of Ext.WindowMgr. In my case, I am using a button to retrieve info that I want about each window so I can store size and position in a database. Here's my button object:
You could adapt this code to be a general function to return an array of all open windows rather than storing the attributes.PHP Code:{
xtype:'button'
,text: 'Save Layout'
,handler: function(){
Ext.WindowMgr.each(
function(win){
if(win.isVisible())
{
var height = win.getHeight();
var width = win.getWidth();
var xpos = win.getPosition(true)[0];
var ypos = win.getPosition(true)[1];
//Do AJAXy stuff here
}
}
);
}
-
24 Jul 2009 4:17 AM #3
-
24 Jul 2009 4:34 AM #4
Oh, wow. I didn't even realize this was in the GXT forum. I need to pay more attention!
It looks like the best you could do in GXT is loop through all of your windows to see if they exist/are hidden. This would require knowing the IDs of all of your windows. So, like Martin said, you should probably extend the window class to have listener events for windowActivate, windowDeactivate (or maybe there are registration events?), etc.
I am sorry I can't be of more assistance. I don't know GXT very well.


Reply With Quote