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 › mousePressed to save a tif
Page Index Toggle Pages: 1
mousePressed to save a tif (Read 541 times)
mousePressed to save a tif
Jan 26th, 2009, 4:55am
 
Hi,
Just getting started using this awesome tool and one thing I can't figure out.  I've used:

void mousePressed() {
  save("filename.tif");
}

in several  files and get the tif saved okay.  Others I try it in and keep getting an "unexpected 'void'" error.

Not sure what to look at to figure this out or what to do.

Can you help?

Tks,
Jeff
Re: mousePressed to save a tif
Reply #1 - Jan 26th, 2009, 10:43am
 
Without seeing any code, I can only guess...
But I got this error (again!) yesterday when I wanted to add a function to a sketch without setup() definition.
In other words, you start coding a little sketch, a few lines running fine without setup nor draw. Then you think it would be nice to save it, so you add your function. And bam! it doesn't compile anymore.
As said, add setup() (perhaps with noLoop()), and draw() (I think it is necessary to take in account keyboard/mouse events, can be empty).
Put your code in setup() or split it between init code in setup() and draw code in draw(). In the later case, don't forget to put declarations of variables shared between both functions at sketch level.
Re: mousePressed to save a tif
Reply #2 - Jan 26th, 2009, 4:01pm
 
Thanks for the suggestions.  I'll give them a try and see what I get.  I believe I did try the setup() in one and it didn't work but there are more things here that I can try.

Back to the drawing board,
Jeff
Page Index Toggle Pages: 1