I am having issues with the tab order in the following code. This snippet creates a frame, puts a panel in the frame, places a checkbox followed by a textctrl; tabbing from the checkbox goes into the textctl as expected. Then I start nesting things onto the main panel: a child panel, on which i place a checkbox followed by a textctl. On these subpanels, when I place the focus on the checkbox and press tab, the focus goes NOT to the textctrl but to the next checkbox on the next panel, skipping the textctrl. What am I doing wrong here?
Thanks for any advice,
Hank
import wx
class TestApp(wx.PySimpleApp):
···
#---
def MakeFrame(self):
self.frame=wx.Frame(None,-1,'Testing InputWidgets',size=(750,500))
self.frame.CreateStatusBar()
self.panel=wx.Panel(self.frame,-1)
self.panel.SetBackgroundColour('yellow')
mainSizer=wx.BoxSizer(wx.VERTICAL)
self.panel.SetSizer(mainSizer)
mainSizer.Add(wx.CheckBox(self.panel,-1,'click'))
mainSizer.Add(wx.TextCtrl(self.panel,-1,value='bic'),0,wx.ALL|wx.EXPAND,6)
#--- layout test widgets
colours=['pink','wheat','blue','green','white']
for i in range(2):
panel=wx.Panel(self.panel,-1,style=wx.SIMPLE_BORDER)
szr=wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(szr)
szr.Add(wx.CheckBox(panel,-1,'click'))
szr.Add(wx.TextCtrl(panel,-1),0,wx.ALL|wx.EXPAND,6)
mainSizer.Add(panel,0,wx.EXPAND|wx.ALL,4)
panel.SetBackgroundColour(colours[i%len(colours)])
self.frame.Show()
#---
def OnInit(self):
self.MakeFrame()
return True
def OnClose(self,evt):
self.frame.Destroy()
#---
app=TestApp(redirect=False)
app.MainLoop()