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 › redraw()ing a frame
Page Index Toggle Pages: 1
redraw()ing a frame (Read 289 times)
redraw()ing a frame
Nov 13th, 2008, 3:59pm
 
Hi everyone,
I've created a little synonym generator using controlp5 and prohtml, which you enter a sentence into and it replaces every word.  Now, how I'm doing this is creating a new instance of a class for every word, and storing those instances in an array.  Problem is, this is all triggered by the controlp5 controlEvent().  I want to display an image that says "Loading" when it starts creating these classes because in between, it's not redrawing the frame so even if I draw an image, it doesn't show up until all the words have been returned.  I've tried using redraw(), but flagging it to be drawn again doesn't do anything until my controlEvent() is done.  Any suggestions?  Thanks!
Re: redraw()ing a frame
Reply #1 - Nov 13th, 2008, 8:01pm
 
You certainly want to use threads.

Doing the time-consuming work in a separate thread would allow you to continue to draw things on the window at the same time.

There are many posts on the forum that are dealing with threads and image-loading issues. Just perform a search with the thread keyword.
Re: redraw()ing a frame
Reply #2 - Nov 14th, 2008, 7:04pm
 
Sounds good.  I was wondering about that.

Thanks.
Page Index Toggle Pages: 1