[wxPython-users] AuiNotebook tab being raised when another app is minimized

Frank Niessink frank at niessink.com
Tue Aug 21 14:16:31 PDT 2007


Hi Robin,

2007/8/21, Robin Dunn <robin at alldunn.com>:
> Frank Niessink wrote:
> > Hi,
> >
> > I've a strange problem on Windows (wxPython 2.8.4.0). Task Coach uses
> > an AuiNotebook in its main window. When the Task Coach main window is
> > shown and *another* application is minimized the last but one tab in
> > the AuiNotebook is activated. I haven't been able to replicate this
> > with a small app or the demo. Suggestions for how to debug this are
> > very welcome!
>
> When a wx frame is activated it tries to restore the focus to whatever
> widget it thinks had the focus before the frame lost activation.  My
> guess is that there is something going wrong there or that something in
> your app or AUI is confusing it in some way.

I'm not really sure what is going on, but catching
wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING and then vetoing the event if the
TopLevelParent is not active helped. In code:

class MyAuiNotebook(wx.aui.AuiNotebook):
    def __init__(self, *args, **kwargs):
        super(MyAuiNotebook, self).__init__(*args, **kwargs)
        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING, self.onPageChanging)

    def onPageChanging(self, event):
        if self.GetTopLevelParent().IsActive():
            event.Skip()
        else:
            event.Veto()

Cheers, Frank




More information about the wxpython-users mailing list