Move event processing into function. Terminate the program when the window is closed.
Move event processing into function. Terminate the program when the window is closed.

SamBeirne/Sandbox,SamBeirne/Sandbox