window "raise" event

Is there a way to detect whenever a window is brought to the foreground, i.e. by clicking on any part of it or one of its non-frame children? I am juggling multiple GLCanvas objects in different frames and the mouse controls and view matrices are (of course) getting mixed up when I switch between windows because I need to call GLCanvas.SetCurrent() first. It looks like I can work around the worst problems by calling SetCurrent() in every mouse event handler in the GLCanvas, along with EVT_PAINT and EVT_SIZE, but can I also do the same for clicks on the frame’s titlebar, toolbar, statusbar, etc.? Is there something like EVT_RAISE? (I already know this doesn’t actually exist, but that’s the behavior I want - binding EVT_CHILD_FOCUS in the Frame didn’t help.)

thanks,

Nat

Hi,

···

On Tue, Dec 15, 2009 at 12:08 PM, Nathaniel Echols <nathaniel.echols@gmail.com> wrote:

Is there a way to detect whenever a window is brought to the foreground,
i.e. by clicking on any part of it or one of its non-frame children? I am
juggling multiple GLCanvas objects in different frames and the mouse
controls and view matrices are (of course) getting mixed up when I switch
between windows because I need to call GLCanvas.SetCurrent() first. It
looks like I can work around the worst problems by calling SetCurrent() in
every mouse event handler in the GLCanvas, along with EVT_PAINT and
EVT_SIZE, but can I also do the same for clicks on the frame's titlebar,
toolbar, statusbar, etc.? Is there something like EVT_RAISE? (I already
know this doesn't actually exist, but that's the behavior I want - binding
EVT_CHILD_FOCUS in the Frame didn't help.)

see: wx.EVT_ACTIVATE

Cody

Perfect. Thank you!

···

On Tue, Dec 15, 2009 at 6:12 PM, Cody Precord codyprecord@gmail.com wrote:

On Tue, Dec 15, 2009 at 12:08 PM, Nathaniel Echols > > nathaniel.echols@gmail.com wrote:

Is there a way to detect whenever a window is brought to the foreground,

i.e. by clicking on any part of it or one of its non-frame children? I am

juggling multiple GLCanvas objects in different frames and the mouse

controls and view matrices are (of course) getting mixed up when I switch

between windows because I need to call GLCanvas.SetCurrent() first. It

looks like I can work around the worst problems by calling SetCurrent() in

every mouse event handler in the GLCanvas, along with EVT_PAINT and

EVT_SIZE, but can I also do the same for clicks on the frame’s titlebar,

toolbar, statusbar, etc.? Is there something like EVT_RAISE? (I already

know this doesn’t actually exist, but that’s the behavior I want - binding

EVT_CHILD_FOCUS in the Frame didn’t help.)

see: wx.EVT_ACTIVATE