We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › hi, newb question..
Page Index Toggle Pages: 1
hi, newb question.. (Read 593 times)
hi, newb question..
May 27th, 2009, 6:14pm
 
is there a way to pause a Processing program indefinitely while it waits for user input? for example if you were doing a questionnaire and in order to get to the next question you need to click an answer.  thanks.
Re: hi, newb question..
Reply #1 - May 27th, 2009, 10:03pm
 
If you use noLoop(), it will only draw once until redraw() or loop() is called.

As long as you define draw() (even if it's empty) mouse events still work.

http://processing.org/reference/noLoop_.html
Re: hi, newb question..
Reply #2 - May 28th, 2009, 7:21am
 
Or you could put smaller loops inside your main loop which break up the questions. So something like:

Code:

int progress = 0;

void draw(){
    while(progress == 0){
         ask question;
         check for user input;
         if(input_received){
              progress++;
         }
    }
    while(progress == 1){
         ask question;
         check for user input;
         if(input_received){
              progress++;
         }
    }
    while... etc, etc
}


Not sure if that would be any better, but it's a different approach.
Page Index Toggle Pages: 1