[wxPython] Accelerator keys and wxSplitterWindow

I'm having trouble with using windows accelerator keys to navigate
through the fields in a window, when the window contains a wxSplitterWindow.

I have a wxPanel with style = wxTAB_TRAVERSAL containing some wxTextCtrl's,
each preceeded by a wxStaticText control. The static text controls have
labels with an ampersand to indicate a windows accelerator key. Since static
text can't actually receive the focus in windows, pressing the accelerator key
sets the focus to the following wxTextCtrl as desired. This works fine.

However, if I replace one of the wxTextCtrl's with a wxSplitterWindow with two
wxTextCtrl panes, both the accelerator before the splitter and tabbing to the
splitter stop working. I can fix the tabbing by using
EVT_SET_FOCUS to detect when the focus is set to the splitter and setting the
focus to one of the panes. However, this doesn't help with the accelerator.
The accelerator for the preceeding label skips over the splitter and sends the
focus to the next plain text control.

I am using wxPython 2.2.1 and Python 1.5.2 on Windows 98.

Here is my sample code:

···

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

from wxPython.wx import *
import time
import string

ID_EXIT = 101
ID_PANE = 102
ID_BUTTON1 = 110
ID_BUTTON2 = 111
ID_TEXT1 = 112
ID_TEXT1B = 130
ID_TEXT2 = 113
ID_TEXT3 = 117
ID_STAT1 = 114
ID_STAT2 = 115
ID_STAT3 = 116
ID_SPLIT = 120

class TabPane(wxPanel):
  def __init__(self, parent, ID, title):
    wxPanel.__init__(self, parent, ID, style = wxTAB_TRAVERSAL)
    self.vs = wxBoxSizer(wxVERTICAL)
    self.label = wxStaticText(self, ID_STAT1, "&Type here")
    self.splitter = wxSplitterWindow(self, ID_SPLIT, \
      size = wxSize(500,200))
    self.textbox = wxTextCtrl(self.splitter, ID_TEXT1, value = "[first one]",

      name = 'type here', style = wxTE_MULTILINE)
    self.textboxb = wxTextCtrl(self.splitter, ID_TEXT1B,
      value = "[bbbbbbbbbbbbbbbbbbb]",
      name = 'here b', style = wxTE_MULTILINE)
# self.splitter.Initialize(self.textbox)
    EVT_SET_FOCUS(self.splitter, self.FocusSplitter)
    self.splitter.SplitHorizontally(self.textbox, self.textboxb, 100)
    self.label2 = wxStaticText(self, ID_STAT2, "or &instead")
    self.textbox2 = wxTextCtrl(self, ID_TEXT2, value = "[none]",
      name = 'or here', style = wxTE_MULTILINE)
    self.label3 = wxStaticText(self, ID_STAT3, "&Short")
    self.textbox3 = wxTextCtrl(self, ID_TEXT3, value = "<single>",
      name = 'short')
    self.button = wxButton(self, ID_BUTTON1, "OK", name = "&OK")
    self.button2 = wxButton(self, ID_BUTTON2, "Cancel", name = "Cancel")
    self.SetDefaultItem(self.button)
    self.vs.Add(self.label, 0, wxEXPAND | wxALL, 4)
# self.vs.Add(self.textbox, 1, wxEXPAND | wxALL, 4)
    self.vs.Add(self.splitter, 1, wxEXPAND | wxALL, 4)
    self.vs.Add(self.label2, 0, wxEXPAND | wxALL, 4)
    self.vs.Add(self.textbox2, 1, wxEXPAND | wxALL, 4)
    self.vs.Add(self.label3, 0, wxEXPAND | wxALL, 4)
    self.vs.Add(self.textbox3, 0, wxEXPAND | wxALL, 4)
    self.hs = wxBoxSizer(wxHORIZONTAL)
    self.vs.Add(self.hs, 0, wxEXPAND | wxALL, 4)
    self.hs.Add(self.button, 0, wxEXPAND | wxALL, 4)
    self.hs.Add(self.button2, 0, wxEXPAND | wxALL, 4)
    self.SetAutoLayout(1)
    self.SetSizer(self.vs)
    self.vs.Fit(self)
    self.vs.SetSizeHints(self)
  def FocusSplitter(self, event):
    self.textbox.SetFocus()

class TabFrame(wxFrame):
  def __init__(self, parent, ID, title):
    wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
    wxSize(1000, 600))

    file_menu=wxMenu()
    file_menu.Append(ID_EXIT,"E&xit","Terminate")

    window_menu = wxMenu()

    edit_menu = wxMenu()

    menuBar=wxMenuBar()
    menuBar.Append(file_menu,"&File");

    self.CreateStatusBar()

    self.SetMenuBar(menuBar)
    EVT_MENU(self,ID_EXIT,self.QuitNow)

    self.pane = TabPane(self, ID_PANE, "TabPane")
  def QuitNow(self, event):
    self.Close(true)

class TabTest(wxApp):
  def OnInit(self):
    frame = TabFrame(NULL, -1, "TabFrame")
    frame.Show(true)
    self.SetTopWindow(frame)
  # frame.editor.SetFocus()
# frame.editor.SetSelection(3, 9)
    return true

def run():
  app=TabTest(0)
  app.MainLoop()

if __name__ =='__main__':
  run()

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

Thanks in advance,
David Fox

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://home.netscape.com/webmail
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users