So I'm fairly new to flex.  I'm trying to use flexmdi to manage my dashboard 
layout.  I want to tile with fillSpace = true on the minimize, restore, and 
close events of a mdiWindow.  A auto-layout if you will.  The code below only 
works on minimize after a second window is minimized.  It also works on the 
restore of windows, but the sizes are being saved so the restore is to the 
previous size and location and some of the other windows move. 

Thanks for any help.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
xmlns:flexmdi="flexlib.mdi.containers.*"
    layout="vertical"
    creationComplete="onCreationComplete()" >
   

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;           
            import flexlib.mdi.events.MDIWindowEvent;           
            import flexlib.mdi.events.MDIManagerEvent;           
            import flexlib.mdi.effects.effectsLib.*;

            private function onCreationComplete():void
            {
                mdiCanvas.windowManager.tile(true, 10);
                
mdiCanvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_MINIMIZE, 
onWindowMinimize);
                
mdiCanvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_RESTORE, 
onWindowRestore);           
                
mdiCanvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_CLOSE, 
onWindowClose);               
            }
           
            private function onWindowMinimize(event:MDIManagerEvent):void
            {
                mdiCanvas.windowManager.tile(true, 10);
            }
           
            private function onWindowRestore(event:MDIManagerEvent):void
            {
               
                mdiCanvas.windowManager.tile(true, 10);
           
            }
           
            private function onWindowClose(event:MDIManagerEvent):void
            {
               
                mdiCanvas.windowManager.tile(true, 10);
            }           
           
        ]]>
    </mx:Script>
   
    <mx:VBox width="100%" height="100%">
   
        <mx:ApplicationControlBar>
            <mx:Button id="btnTile" label="Tile Windows" 
click="{mdiCanvas.windowManager.tile(true, 10)}" />
            <mx:Button id="btnCascade" label="Cascade Windows" 
click="{mdiCanvas.windowManager.cascade()}" />
        </mx:ApplicationControlBar>       
       
        <flexmdi:MDICanvas id="mdiCanvas" width="100%" height="100%" 
effectsLib="{flexlib.mdi.effects.effectsLib.MDIVistaEffects}">
            <flexmdi:MDIWindow id="window1" width="300" height="300" 
title="chart 1" />
            <flexmdi:MDIWindow id="window2" width="300" height="300" 
title="chart 2" />
            <flexmdi:MDIWindow id="window3" width="300" height="300" 
title="chart 3" />
            <flexmdi:MDIWindow id="window4" width="300" height="300" 
title="chart 4" />
            <flexmdi:MDIWindow id="window5" width="300" height="300" 
title="chart 5" />
            <flexmdi:MDIWindow id="window6" width="300" height="300" 
title="chart 6" />
        </flexmdi:MDICanvas>   
       
    </mx:VBox>

</mx:Application>

Reply via email to