Controlling iteration flow from std input

Hi everyone.
I have a root file in which each event corresponds to a 128-points sampling of the voltage of a detector. I’m trying to build up a program that shows these samplings. For example, as the program runs a loop over all the events, i would like to control the flow of this loop from keyboard, so after event n is displayed, I would like to see the event n+1 after pressing a key.
The problem is that i’m compiling it outside root and I am not able to bypass the fact that, by using TApplication class, after I do app.Run() the program flow is frozen until I close the graphics window. Is there a way to tell it to “listen” to any keyboard pressed by the user and perform any action as a consequence? For example the simple “press any key to continue” ? I cannot really figure it out,

thanks ,

Hi,

check root.cern.ch/root/html/TPad#TPad:WaitPrimitive - gPad->WaitPrimitive() should do what you want.

Cheers, Axel.

see example in $ROOTSYS/tutorials/spectrum/peaks2.C

Rene

It worked perfectly.
It’s really great: thank you very much again! : )