Modal frames

I'm running on windows 2000 and wx version 2.4.2.4

Can someone suggest how I can move focus to the current modal window if one of the non-modal windows is selected.

If the current modal window is hidden or minimized and the user selects a non-modal window I get a beep but otherwise nothing happens. The user has no indication why it's beeping and nothing changes.

If the modal window was a dialog it would automatically be given focus and be brought to the top level, which is the behaviour I'm trying to mimic.

Thanks,
Mike

from wxPython.wx import *

···

#---------------------------------------------------------------------------

class MyFrame(wxFrame):
     def __init__(self, parent, ID, title, pos=wxDefaultPosition,
                  size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE, parentclosehandler=None):
         wxFrame.__init__(self, parent, ID, title, pos, size, style)
         panel = wxPanel(self, -1)
         print parentclosehandler
         if parentclosehandler:
             EVT_CLOSE(self, parentclosehandler)
         EVT_CLOSE(self, self.OnCloseWindow)
         button = wxButton(panel, 1003, "Close Me")
         button.SetPosition(wxPoint(15, 15))
         EVT_BUTTON(self, 1003, self.OnCloseMe)
         self.go_ahead = None

         button = wxButton(panel, -1, "New Modal")
         button.SetPosition(wxPoint(100, 15))
         EVT_BUTTON(self, button.GetId(), self.NewModalClick)

         button = wxButton(panel, 1004, "Close And New")
         button.SetPosition(wxPoint(175, 15))
         EVT_BUTTON(self, 1004, self.OnCloseAndNew)

     def OnCloseMe(self, event):
         self.Close(True)

     def OnCloseWindow(self, event):
         print 'in onclosewindow'
         self.MakeModal(False)
         self.Destroy()
         event.Skip()

     def NewModalClick(self, evt):
         f = MyFrame(self,-1,"We are Modal now", size=(350,100),parentclosehandler=self.OnChildModalClose)
         #EVT_CLOSE(f, self.OnChildModalClose)
         f.MakeModal(True)
         f.Show(True)

     def OnCloseAndNew(self, evt):
         print 'in oncloseandnew'
         p= self.GetParent()
         if hasattr(p,'go_ahead'):
             print 'happy'
             p.go_ahead = 1
         else:
             print 'sad'
         self.Close(True)
     def OnChildModalClose(self, evt):
         print 'in onchildmodalclose'
         self.MakeModal(True)
         if self.go_ahead:
             f = MyFrame(self,-1,"We are Modal now", size=(350,100),parentclosehandler=self.OnChildModalClose)
             f.MakeModal(True)
             f.Show(True)
             self.go_ahead = None
         evt.Skip()

#---------------------------------------------------------------------------

def runTest(frame, nb, log):
     win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
                   style = wxDEFAULT_FRAME_STYLE)# | wxFRAME_TOOL_WINDOW )
     frame.otherWin = win
     win.Show(True)

#---------------------------------------------------------------------------

overview = """\
"""

if __name__ == '__main__':

     import sys
     app = wxPySimpleApp()
     frame = MyFrame(None, -1,"The Title")
     frame.Show(true)
     app.MainLoop()