Posted by @st@l@vist@ in SWF Studio V3 on Feb 20 2008, 08:59 am

Simple script:

ssCore.init();
ssDefaults.synchronousCommands = true;
ssCore.Win.setNotify({event:"onFocusChange"}, {callback:onFocusChange});

function onFocusChange(r:Object, c:Object, e:Object):void
{
   ssDebug.trace(r.result);
}


If you will to click on the minimize button of the window, you will recieve notification about GOTFOCUS event! But another application got focus and you can work with him. When you will restore the window, you will again recieve COTFOCUS event.


Posted by mbd in SWF Studio V3 on Feb 20 2008, 09:42 am

Do you receive a LOSTFOCUS notification after the first GOTFOCUS?


Posted by @st@l@vist@ in SWF Studio V3 on Feb 20 2008, 09:56 am

No.

GOTFOCUS // on minimize

GOTFOCUS // twice on restore
GOTFOCUS

And when I click on the icon on the taskbar to toggle states (minimize / restored), I get the events in the following order:

// Click to Minimize

LOSTFOCUS
GOTFOCUS

// Click to restore

GOTFOCUS


Posted by northcode in SWF Studio V3 on Feb 20 2008, 11:56 am

If you minimize your application by clicking on the minimize button you don't get a LOSTFOCUS event. If you minimize it by clicking on the taskbar button then you do get the LOSTFOCUS event. The problem would seem to be with the minimize code and how we handle that. If you just click off your app (on the desktop, or another app) the GOT/LOST focus events are generated properly. We'll have a closer look at this.


Posted by @st@l@vist@ in SWF Studio V3 on Feb 20 2008, 04:39 pm

Just have a question. It's not a problem, but is not logical.

I can use SWFStudio API and do the window minimized, maximized, change his size or position.

Using Win.setSize command will trigger Win.onResize and Win.onMove events.
Using Win.minimize command will trigger Win.onSateChange and (May be will :)) Win.onFocusChange events.
Using Win.setPosition command will trigger nothing ...

ssCore.init();
ssDefaults.synchronousCommands = true;
loaderInfo.addEventListener(Event.COMPLETE, init);

function init(e:Event):void
{
   loaderInfo.removeEventListener(Event.COMPLETE, init);
   stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
   stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
   ssCore.Win.setNotify({event:"onMove"}, {callback:ssMoveHandler});
   ssCore.Win.setNotify({event:"onResize"}, {callback:ssResizeHandler});
}

function mouseDownHandler(e:Event):void
{
   ssCore.Win.setSize({width:int(Math.random() * 300) + 100, height:400});
}

function mouseUpHandler(e:Event):void
{
   <font color='Red'>// The event Win.onMove will not be triggered</font>
   ssCore.Win.setPosition({x:int(Math.random() * 100), y:0});
}

function ssMoveHandler(r:Object, c:Object, e:Object):void
{
   ssDebug.trace("onMove : " + r.result);
}

function ssResizeHandler(r:Object, c:Object, e:Object):void
{
   ssDebug.trace("onResize : " + r.result);
}


Posted by northcode in SWF Studio V3 on Feb 20 2008, 07:14 pm

That one is a bug. The windows message we watch for "move" activity is not generated when we explicitly set the position, so the event is not raised. That was a one liner so I just fixed it. It will be in the official V3.5 release. I'll also create a problem report. Thanks.

Note: A call to Win.setPosition that does not result in a change in the window position will not generate an onMove event.