Determining when an application is put in the background

I’m currently developing a bodge of the listbox in a popupwindow (that doesn’t work, as per comments in the wxdemo) using a frame instead. I can get it working almost exactly how I want to, however I need to set it to stay on top (which is fine) but that means it stays on top of any other applications that I switch to (via Alt-tab) for instance. I need a snippet of code that will detect when my application is put in the background and then I can trigger my pubsub message to close the listbox frame so it doesn’t stay on top of other applications. I’ve tried EVT_KILL_FOCUS but it doesn’t do anything.

Hi,

···

On Wed, Apr 4, 2012 at 9:56 AM, johnharris85 <john@johnharris.tv> wrote:

I'm currently developing a bodge of the listbox in a popupwindow (that
doesn't work, as per comments in the wxdemo) using a frame instead. I can
get it working almost exactly how I want to, however I need to set it to
stay on top (which is fine) but that means it stays on top of any other
applications that I switch to (via Alt-tab) for instance. I need a snippet
of code that will detect when my application is put in the background and
then I can trigger my pubsub message to close the listbox frame so it
doesn't stay on top of other applications. I've tried EVT_KILL_FOCUS but it
doesn't do anything.

Would try wx.EVT_ACTIVATE on your Frame instance. It should get fired
when the frame becomes active/inactive. See its Active property to
determine which state it is in when fired.

Cody