wxTextCtrl tabbing problem on Windows

Hi --

I'm seeing something odd on WIndows with tab traversal. If I have a pair of text ctrl widgets in a wxDialog, the tab order will skip the second one if they're richtext widgets; otherwise it works fine. It also works fine if I put them in a panel in the dialog.

Sample code below. Any ideas?

activestate Python 2.2.2 , wxPython 2.4.2.4.

thanks,
--bob

from wxPython.wx import *
class PassphraseVerifyDialog(wxDialog):

     def __init__(self, parent, message1, message2, caption):

         wxDialog.__init__(self, parent, -1, caption,
                           style = wxDEFAULT_DIALOG_STYLE |wxTAB_TRAVERSAL)

         # p = wxPanel(self, -1)
         p = self

         topsizer = wxBoxSizer(wxVERTICAL)

         showBug = 1

         if showBug:
             txtStyle = wxTE_RICH
         else:
             txtStyle = 0

         text1 = wxTextCtrl(p, -1,
                                 style = txtStyle)
         topsizer.Add(text1, 0, wxEXPAND | wxLEFT | wxRIGHT, 15)

         text2 = wxTextCtrl(p, -1,
                                 style = txtStyle)
         topsizer.Add(text2, 0, wxEXPAND | wxLEFT | wxRIGHT, 15)

         ok = wxButton(p, wxID_OK, "OK")
         topsizer.Add(ok, 0)

         EVT_BUTTON(self, wxID_OK, self.OnOK)

         p.SetSizer(topsizer)
         p.SetAutoLayout(1)
         p.Fit()

     def OnOK(self, event):
         self.EndModal(wxID_OK)

if __name__ == "__main__":

     a = wxPySimpleApp()

     d = PassphraseVerifyDialog(None, "Message", "And again", "Caption")

     print d.ShowModal()
     d.Destroy()

Robert Olson wrote:

Hi --

I'm seeing something odd on WIndows with tab traversal. If I have a pair of text ctrl widgets in a wxDialog, the tab order will skip the second one if they're richtext widgets; otherwise it works fine.

This is a known problem and I think it has been fixed in 2.5 already.

It also works fine if I put them in a panel in the dialog.

Yes, this is the suggested workaround.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!