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 › get stored window position
Page Index Toggle Pages: 1
get stored window position (Read 1178 times)
get stored window position
Nov 8th, 2009, 1:41am
 
hi everyone,

how can i get the stored window position ??
i need it to set the position of my controllwindow.

regards maik
Re: get stored window position
Reply #1 - Nov 8th, 2009, 2:11am
 
Code:
void setup()
{
size(300, 500);
}

void draw()
{
background(255);
rect(50, 50, 100, 100);
}

void mousePressed()
{
Rectangle r = frame.getBounds();
println(r.x + " " + r.y + " " + r.width + " " + r.height);
}
Re: get stored window position
Reply #2 - Nov 8th, 2009, 6:38am
 
thanks,

didn't work in setup()
Code:

Rectangle r = frame.getBounds();
 controlP5 = new ControlP5(this);
 controlWindow = controlP5.addControlWindow("Settings",r.x,r.y,400,400);
 controlWindow.setBackground(color(0));

gets r.x = 0  r.y = 0

regards maik
Re: get stored window position
Reply #3 - Nov 8th, 2009, 6:47am
 
In setup(), the frame might have not been created yet.
Re: get stored window position
Reply #4 - Nov 8th, 2009, 7:46am
 
ok

so it is not possible to get the stored position value's of the sketch window, in setup()??

regards maik
Re: get stored window position
Reply #5 - Nov 8th, 2009, 10:03am
 
You can do something once after setup():
Code:
void CheckPos()
{
Rectangle r = frame.getBounds();
println(r.x + " " + r.y + " " + r.width + " " + r.height);
}

void draw()
{
if (frameCount == 1)
{
CheckPos();
}
background(255);
rect(50, 50, 100, 100);
}
Page Index Toggle Pages: 1