Hi… I am trying to write a gui for interactive analysis chain. GUI is there to accept (many different) inputs from user. Once those inputs are accepted, i want the control to return to main() function so that I can perform rest of the things. GUI doesnot have a Canvas with File menu so that, one can do "QUIT ROOT"
to return from event loop. My main function looks like this…
here… after pressing OK button on GUI, I expected that theApp will return control to main function ( Due to Run.(kTRUE) )…
and fpritnf() statement will be executed… but its not happening…
what am i missing ?? or doing wrong ??
Well, in the routine which manages your “OK” button, try to add:
gSystem->ExitLoop();
or, when you use “theApp.Run(kTRUE);”, you can also try to add:
gApplication->Terminate(0);
Hi…
Thanks… Both of them work…
However, if in main function , I comment the second theApp.Run() statement code crashes after executing fprintf() statement … Why is that ? I dont really understand , how theApp.Run() works ?
Hello,
Guidelines on terminating a TApplication is something that is clearly lacking in Root.
I have a program:
int main(){
TApplication app(“myapp”, 0, 0)
Draw some histograms
app.Run(kTRUE);
printf(“Press Enter\n”);
cin.get();
app.Terminate();
}
I expect that the histograms will be displayed on the screen until the user presses Enter. However, the program never gets past the line app.Run(kTRUE), and I have to resort to such savage methods of breaking the program as Ctrl + C.
Clear explanation of how to terminate TApplication is very much needed.
Regards,
Viesturs