1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    101
    Vote Rating
    0
    Martin.Trummer is on a distinguished road

      0  

    Question 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?

  2. #2
    Ext User
    Join Date
    Mar 2009
    Posts
    20
    Vote Rating
    0
    KellanStec is on a distinguished road

      0  

    Default


    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:

    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
               
    }
          }
      );

    You could adapt this code to be a general function to return an array of all open windows rather than storing the attributes.

  3. #3
    Ext User
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    961
    Vote Rating
    0
    Arno.Nyhm is on a distinguished road

      0  

    Default


    but how this works in GXT?

  4. #4
    Ext User
    Join Date
    Mar 2009
    Posts
    20
    Vote Rating
    0
    KellanStec is on a distinguished road

      0  

    Default


    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.

Thread Participants: 2