cheerq / flexmdi

Automatically exported from code.google.com/p/flexmdi
0 stars 0 forks source link

focusStart event not raised when closing another MDIWindow #48

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open two MDIWindows.
2. Close one MDIWindow.
3. The remening MDIWindow dosn't receive a focusStart event.

What is the expected output? What do you see instead?

The MDIWindow that is remaning needs to be notified that it is now the one 
with focus.
No focusStart event is dispatched. 

What version of the product are you using? On what operating system?
latest flexmdi on Flex 2.0.1

Please provide any additional information below.

Original issue reported on code.google.com by andrea.w...@gmail.com on 13 Nov 2007 at 3:46

GoogleCodeExporter commented 8 years ago
Here below is the code change that I'm proposing for the MDIManager's remove 
method.

It includes also releasing the MDIWindow's windowManager reference to prevent 
memory 
leaks.
Additionally it raises a new MDIWindowEvent.CLOSED event to notify the 
MDIWindow 
that has been closed and released from the MDIManager and therefore it is time 
to 
perform any necessary cleanup to be garbage collected.

        /**
         *  Removes a window instance from the managed window stack 
         *  @param window:MDIWindow Window to remove 
         */
        public function remove(window:MDIWindow):void
        {   

            var index:int = ArrayUtil.getItemIndex(window, 
this.windowList);

            windowList.splice(index, 1);

            if(this.isGlobal)
            {
                PopUpManager.removePopUp(window as 
IFlexDisplayObject);
            }
            else
            {
                container.removeChild(window);
                if( container.numChildren > 0 ) {
                    var newFocusWindow:MDIWindow = MDIWindow( 
container.getChildAt( container.numChildren - 1 ));
                    newFocusWindow.dispatchEvent( new 
MDIWindowEvent( MDIWindowEvent.FOCUS_START, newFocusWindow ) );
                }
            }
            this.removeListeners(window);
            window.windowManager = null;
            window.dispatchEvent( new MDIWindowEvent( 
MDIWindowEvent.CLOSED, window ) );
        }

Original comment by andrea.w...@gmail.com on 13 Nov 2007 at 4:18

GoogleCodeExporter commented 8 years ago

Original comment by ben.clin...@gmail.com on 10 Jan 2008 at 7:16