Stopping a GUI process


I am writing a GUI application that performs some function when a button is clicked. I want to application to stop processing that function when the stop button is pressed. I can’t seem to figure this out. I have been searching for a solution (possibly using TThread) but I cannot find a good example. Currently when the button is pressed a ProcessedEvents() signal is emitted and the handling function calls the Begin() function. This all works fine but when I want to stop the function I can’t. Can you please suggest an example to look at or offer some advice.



Please take a look at $ROOTSYS/tutorials/gui/guitest.C
.x guitest.C -> menu test->Dialog -> Tab3 -> “Start Filling Hists” and “Stop Filling Hists” buttons.
If it doesn’t help, please post a running piece of code illustrating what you’re trying to achieve.