Hi
I'm using wxPython 2.4.0.7u on Win 2k and I've noticed an oddity with
Dialogs and Tab Traversal. The tab traversal works fine, but the controls
don't get the normal dashed border to indicate that they have the focus.
I've knocked up a sample program to demonstrate. There's a frame with a set
of controls on it that displays the correct behaviour (or at least what I
would expect) and the buttons on it launch a couple of dialogs to
demonstrate what is wrong.
Weirdly, the wxBitmapButton on the dialog gets the focus border, but nothing
else does.
Anyone know anything about this?
------ attached code ---->
from wxPython.wx import *
import cStringIO
def getMondrianData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\
\x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00qID
\
ATx\x9c\xed\xd6;\n\x800\x10E\xd1{\xc5\x8d\xb9r\x97\x16\x0b\xad$\x8a\x82:\x16
\
o\xda\x84pB2\x1f\x81Fa\x8c\x9c\x08\x04Z{\xcf\xa72\xbcv\xfa\xc5\x08
\x80r\x80\
\xfc\xa2\x0e\x1c\xe4\xba\xfaX\x1d\xd0\xde]S\x07\x02\xd8>\xe1wa-`\x9fQ\xe9\
\x86\x01\x04\x10\x00\\(Dk\x1b-\x04\xdc\x1d\x07\x14\x98;\x0bS\x7f\x7f\xf9\x13
\
\x04\x10@\xf9X\xbe\x00\xc9 \x14K\xab a\xf0\x00\x00\x00\x00IEND\xaeB`\x82'
def getMondrianImage():
stream = cStringIO.StringIO(getMondrianData())
return wxImageFromStream(stream)
def getMondrianBitmap():
return wxBitmapFromImage(getMondrianImage())
class MyDialog(wxDialog):
def __init__(self, parent):
wxDialog.__init__(self, parent,-1,"My Dialog")
sizer = wxBoxSizer(wxVERTICAL)
staticBox = wxStaticBoxSizer(wxStaticBox(self, -1,
"RadioButtons:"),wxVERTICAL)
chk1 = wxCheckBox(self, -1, "Look, we DON'T get the")
chk2 = wxCheckBox(self, -1, "dashed border on TAB focus")
staticBox.Add(chk1,1,wxEXPAND | wxALL, 5)
staticBox.Add(chk2,1,wxEXPAND | wxALL, 5)
sizer.Add(staticBox, 1, wxEXPAND | wxALL, 5)
imageButton = wxBitmapButton(self, -1, getMondrianBitmap())
sizer.Add(imageButton, 1, wxEXPAND | wxALL, 5)
txt = wxStaticText(self, -1, "But weridly the bitmapbutton\nabove
does get the border")
sizer.Add(txt, 0, wxEXPAND | wxALL, 5)
textButton = wxButton(self, wxID_OK, "Button")
sizer.Add(textButton, 1, wxEXPAND | wxALL, 5)
self.SetSizerAndFit(sizer)
class MyFrame(wxFrame):
def __init__(self, title):
wxFrame.__init__(self, None, -1, "My Frame")
pan = wxPanel(self, -1, style = wxTAB_TRAVERSAL)
sizer = wxBoxSizer(wxVERTICAL)
staticBox = wxStaticBoxSizer(wxStaticBox(pan, -1,
"RadioButtons:"),wxVERTICAL)
chk1 = wxCheckBox(pan, -1, "Look, we DO get the")
chk2 = wxCheckBox(pan, -1, "dashed border on TAB focus")
staticBox.Add(chk1,1,wxEXPAND | wxALL, 5)
staticBox.Add(chk2,1,wxEXPAND | wxALL, 5)
sizer.Add(staticBox, 1, wxEXPAND | wxALL, 5)
imageButton = wxBitmapButton(pan, -1, getMondrianBitmap())
sizer.Add(imageButton, 1, wxEXPAND | wxALL, 5)
textButton = wxButton(pan, -1, "Button")
sizer.Add(textButton, 1, wxEXPAND | wxALL, 5)
EVT_BUTTON(self, imageButton.GetId(), self.DoDialogs)
EVT_BUTTON(self, textButton.GetId(), self.DoDialogs)
pan.SetSizerAndFit(sizer)
def DoDialogs(self, event):
dlg = wxMessageDialog(self, "Message dialog, see how the ok box
get's a dashed focus border when you TAB to it.", "Message Dialog",
wxICON_QUESTION)
dlg.ShowModal()
dlg.Destroy()
dlg = MyDialog(self)
dlg.ShowModal()
dlg.Destroy()
if __name__ == "__main__":
app = wxPySimpleApp()
MyFrame("My Frame").Show()
app.MainLoop()
<----- attached code -----
···
___________________________________________________
Murray Steele
Software Engineer
___________________________________________________
APR Smartlogik Limited.
160 Euston Road * London * NW1 2LZ
phone +44 (0)20 7961 3900
fax +44 (0)20 7961 3949
map: http://www.aprsmartlogik.com/download/pdf/apr_ukmap.pdf
mailto:Murray.Steele@aprsmartlogik.com
http://www.aprsmartlogik.com/
***********************************************************************
This e-mail may contain proprietary and confidential
information and is intended for the recipient(s) only.
If an addressing or transmission error has misdirected this
e-mail, please notify the systems administrator by forwarding
this e-mail to mailto:postmaster@aprsmartlogik.com.
If you are not the intended recipient(s) disclosure, distribution,
copying or printing of this e-mail is strictly prohibited.
***********************************************************************