WIndow control

Ok… this SHOULD be easy… (OSX, Cocoa … XOJOr3)

App Starts…
Open Window 1… which has a progress bar on it… period.
In Win1 ACTIVATE event … a series of tasks take place (scanning folders etc)
When WIN1.ACTIVATE ends (ie last steps in the event) are WIN2.SHOWMODAL

Win2 has in its OPEN event WIN1.close (I have tried putting this in various places)

However WIN2 NEVER closes… WIN1 goes on and does it thing… but WIN1 is still there

What am I missing.

Since win2 is modal, win1 can’t run any code (such as closing) until win2 closes.

but Win2 runs just fine… and I’ve tried every combi of window types for WIN1 (modal, not modal etc)

Basically my program runs perfectly except I have a window hanging around…

It should be a series of 3 windows… BEGIN… MIDDLE and END
where each window calls the next…

here is the events as the actually happen

Enter winBEGIN.OPEN
Exit winBEGIN.OPEN
Enter winBEGIN.Activate
next command is winLEVEL.showmodal
Enter winLEVEL.open
next command is winBEGIN.close
winBEGIN.close <<< CLOSE IS CALLED
EXIT winLevel.open
ENTER winLevel.Activate
EXIT winLEVEL.activate
Exit winBEGIN.Activate <<<< BUT WINDOW DIDN’T CLOSE, otherwise it could never have written this message
ENTER winLevel.Activate
EXIT winLEVEL.activate
winLEVEL.close (ie. quit)

wow… I made it work…

a) put a TIMER on winBEGIN … disabled
b) as last step of winBEGIN.ACTIVATE… it turns on the timer… single shot
c) Timer Action is WINLEVEL.SHOWMODAL
d) first command of WINLEVEL.OPEN is winBEGIN.CLOSE

WIN1 is now a MODELESS DIALOG

seems that as long as the scope was inside winBEGIN.ACTIVATE… nothing could close the window… the Timer delayed just long enough for ACTIVATE to “complete” leaving the window in a state where it truly was “closeable”

It seems like there are several places where you have to get out of the event call chain in order for things to work the way you want. A timer usually solves it.