I'm not exactly sure why your program is locking up, but I do have some suggestions. One important fact to keep in mind is that subroutines called from button clicks are not running in your main program thread, but, rather, the graphical user interface thread. Any long-running calculations should not be handled in that subroutine directly. I normally suggest using the button handler to set a variable and release the main program from idle. Once un-idled, the program will take some action based on the value of that variable. The "Conway's Game of Life" example that comes with Simply Fortran uses this method.
Additionally, OpenMP relies on Windows threading routines internally, and it might make some assumptions about the program's current state in regards to threads. Since AppGraphics programs are already using multiple threads, there may be some sort of deadlock occurring. I'm not positive, though, why that would occur.
I'll look into it more on my end, but I would strongly suggest keeping all OpenMP calls within the main program by using the equivalent of a message loop to handle button presses.
Jeff Armstrong
Approximatrix, LLC