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.
Page Index Toggle Pages: 1
Window Focus (Read 1604 times)
Window Focus
Mar 9th, 2010, 3:17pm
 
Hi,

A Processing sketch is running on my desktop.  I've clicked on a different application, and dragged a window from that application partially on top of the Processing window.  Does anyone know what code I need to put in the processing sketch so that when an event happens and this code is run, the Processing window automatically moves back to the front?

I tried frame.toFront() and unfortunately it doesn't work.  It moves the Processing window to the front of any stack of windows that exists when you first start.  However, if you drag a window from a different application on top of the Processing window, the Processing window doesn't come to the top.  You can see this by running the following code and dragging something on top of the Processing window.

Quote:
boolean state=false;

void setup(){
  background(0,0,0);
  size(200,200);
}

void draw(){
  delay(2000);
  if (state){
    state=false;
    frame.toBack();
  }else{
    state=true;
    frame.toFront();
  }
}



Thanks for any help.  Smiley
~Patch
Re: Window Focus
Reply #1 - Mar 9th, 2010, 3:40pm
 
Making the window alway in top of the other frames is not what you want right?  frame.setAlwaysOnTop(true);

you want it to focus as soon as something happens ?
Re: Window Focus
Reply #2 - Mar 9th, 2010, 3:45pm
 
hmm using this code :

void setup(){
 background(0,0,0);
 size(200,200);
}

void draw(){
 if (frameCount%300==0){
       frame.toFront();
 }
}

void keyPressed(){
   frame.toBack();
}


i can send it to the background on keypress and it comes back every 5 seconds. so isnt this what you want ?

Re: Window Focus
Reply #3 - Mar 9th, 2010, 6:08pm
 
This doesn't work. Sad

When I drag a window from another application on top of the Processing window, the other window always stays on top.  I need the Processing window to come to the top.  

Is this a bug? Do you think it's because I'm running Mac OS X?

thanks,
~Patch
Re: Window Focus
Reply #4 - Mar 10th, 2010, 1:58am
 
What doesn't work? Have you tried frame.setAlwaysOnTop(true);? There is also a isAlwaysOnTopSupported() method to see if your system/toolkit supports this operation.
Page Index Toggle Pages: 1