G4P Window Refresh

Hi all.

I'm probably just missing something, but googled and went through here http://www.lagers.org.uk/g4ptool/ref/index.html and couldn't find an answer.

I have a window created with the G4P tool and wish to add some status indicator / progress indication on my application. Sometimes it has to process some large files and takes a while to complete. The problem is that during this while loop the sketch is static and doesn't update/refresh.

The window is called 'frame' by default (never changed it..) and I tried things like frame.repaint() with no luck. Tried calling draw again (since all my stuff fires from the callbacks, not best practice, I know), tried calling background(x), all with no luck.

How would I go about refreshing the sketch while in a while loop to have some status progress indication?

Thanks

J

Answers

  • Answer ✓

    This is not a problem only associated with G4P the same applies with Processing.

    If you start a lengthy process from the draw method, such as loading a large file then the display can't be updated until that process is finished. One solution would be to load the file in a separate thread and then the draw method could check for progress. The same applies if the process is started in the event thread e.g. mouse click handler.

  • Awesome, thanks a lot for the suggestion. Onwards to new territories!

    I found this to whoever has this problem and don't know how to create new threads like I did. http://wiki.processing.org/w/Threading

Sign In or Register to comment.