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 › frame.setLocation not working...
Page Index Toggle Pages: 1
frame.setLocation not working... ? (Read 2910 times)
frame.setLocation not working... ?
Dec 24th, 2009, 5:10pm
 
How come this doesn't work in the default mode?  It should set the sketch in the center of the screen, but doesn't.  Change it to P2D, P3D, or OpenGL and it works.  What gives.. is this a bug or am I doing something wrong?

void setup(){
 size(650, 400);
 frame.setLocation(screen.width/2-325,screen.height/2-200);
}

Running a mac... note that once it's in the center (you test it with P2D or something) it will stay in the center until you close and reopen the sketch.
Re: frame.setLocation not working... ?
Reply #1 - Dec 25th, 2009, 2:33am
 
I collected a note in my list of Processing tricks:
"In OpenGL mode put in the setup(), in normal mode put in the draw()." (the setLocation() call, of course)
Re: frame.setLocation not working... ?
Reply #2 - Dec 25th, 2009, 5:22am
 
That did it! Thanks PhiLho
I wouldn't mind getting a peak at your list O P5 tricks. I'm sure it's quite long by now. haha
Re: frame.setLocation not working... ?
Reply #3 - Dec 25th, 2009, 3:23pm
 
You can find it at:
http://bazaar.launchpad.net/~philho/%2Bjunk/Processing/annotate/head%3A/ProcessingTricks.txt
Collected from various posts in the forum, mostly.
Page Index Toggle Pages: 1