Ok,
So once my morning caffeine jolt hit me, I realized that I already
know how to force a mouseclick in the event:
newPanel.minimize(new MouseEvent(MouseEvent.CLICK, true, false));
So, I fire the event and even walked the code thru the debugger to
watch it go into the function and "act" normally...but my window still
defiantly sits un-minimized....sigh...
Adrian
-------- Original Message --------
Subject: how to forcibly minimize a window via flexmdi window
Date: Mon, 02 Feb 2009 09:12:40 -0600
From: Adrian Williams <[email protected]>
To: [email protected]
Hi gang,
I've been toying with the outstanding flexmdi component from flexlib
and have found something challenging...
One of the pieces of the MDIWindow is the minimize() function. I'm
creating the windows on the canvas dynamically based on the users last
know settings...including whether they have minimized any of the windows
on their dashboard. I have a variable in their record for each window
called isCollapsed (bit/bool). What I'm trying to do is when the
records are read and the windows are dynamically created, I check to see
if the isCollapsed == true and if so, I'm trying to fire the
MDIWindow.minimize() function. However, it's expecting a mouseEvent and
I'm not sure how to force a non-existent event into the function???
Basically, I need to programmatically emulate a mouseclick on the
minimize button of the window.
I've tried a number of alternative methods without success,
including these:
newWindow.minimize();
newWindow.minimize(null);
newWindow.dispatchEvent(MDIWindowEvent.MINIMIZE);
dispatchEvent(new
MDIWindowEvent(MDIWindowEvent.MINIMIZE, newWindow));
Here is the minimize function:
public function minimize(event:MouseEvent = null):void
{
// if the panel is floating, save its state
if(windowState == MDIWindowState.NORMAL)
{
savePanel();
}
dispatchEvent(new MDIWindowEvent(MDIWindowEvent.MINIMIZE,
this));
windowState = MDIWindowState.MINIMIZED;
showControls = false;
}
Has anyone tried to do this or have any ideas on what to try next?
Thanks,
Adrian