Hi. I have an expression that first creates a modal notification window, and upon hitting OK, it creates a second, edit window. In the edit window, there's a Refresh button that closes the window and re-executes the original expression. When I hit "Refresh", the edit window closes as expected, and the modal notification window appears again. However, the second iteration of the edit window appears with a "2" appended to its name ("editwin 2") even though the original editwin already closed. Furthermore, the << On Close script that is supposed to immediately run when the edit window is closed the first time does not run until after the second instance of the notification window is closed and the second instance of the edit window is about to open. It seems like although the edit window is closed, it persists in the memory until the next instance of the edit window appears.
Does anyone have a good explanation for this behavior, and more importantly, what's the workaround?
Thanks.
Names Default To Here( 1 );
Delete Symbols();
editwin.expr = Expr(
BB1 = ButtonBox("ok",
Window("editwin") << Close Window;
);
BB2 = ButtonBox("Refresh",
Window("editwin") << Close Window;
editwin.expr;
);
modwin = New Window("modwin", << Modal,
TextBox("I'm a notification window"),
ButtonBox("OK", Write("Closing modwin\!N"))
);
editwin = New Window("editwin",
TextBox("I'm an edit window"),
BB1, BB2
);
editwin << On Close(Write("Closing editwin\!N"));
editwin << Set Window Size(300, 200);
);
editwin.expr;