To explain, when I have a program running and when the user moves the mouse, the program should “restart” i.e. the program restarts as if it was just opened. I have tried resetting everything, but to get it to restart I have to close and reopen it.
I am imagining the OP has something like the Game of Life, or a monitoring software.
While it runs, it does things, displays things, draws things, based on an initial condition.
The initial condition will be ‘whatever the variables are set to’ when the app starts.
Often people have default variable values set in the IDE.
Instead, they should all be initialised in a method - call it Init perhaps?
When the app starts, call Init to set things up and start running.
If the mouse moves over the window, call Init again and refresh the screen.