Bug in Combobox?

Hi, I'm having some troubles...

Take the example program here:

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        wx.Frame.__init__(self, None, -1, "test")
        self.cb = wx.ComboBox(self, -1, style = wx.CB_READONLY)
        self.cb.Bind(wx.EVT_COMBOBOX, self.OnEvent)

        self.cb.Append("Blurb")
        self.cb.SetValue("Blurb")
        self.cb.Delete(0)
        print self.cb.GetValue()
        self.cb.Append("bla")

    def OnEvent(self, event):
        print 'CB_EVENT'
        print self.cb.GetValue()

class Application(wx.App):
    def OnInit(self):
        win = MyFrame(None, -1, "")
        win.Show(True)
        return True
    
# end of class MyFrame1
app = Application(0)
app.MainLoop()

Run it, and select the only entry in the combobox, and exit.

In my opinion, the outputput should be
"" (i.e. nothing selected)
CB_EVENT
Bla

But the output I get:

Blurb

This not only means, that the first print produces a wrong result (The
checkbox is empty, thus GetValue should return such), and second, I'm not
receiving the Checkbox event, because I don't get the CB_EVENT.
Any idea what causes this?
May be it's os-specific. I'm on Windows XP :frowning:

Thanks

Hello Benjamin,

this seems to be a bug for me.
If I replace wx.CB_READONLY with wx.CB_DROPDOWN,
the sample works a expected.

···

On Thu, 15 Sep 2005 15:01:57 +0200, "Benjamin Schindler" <bschindler@student.ethz.ch> wrote:

Hi, I'm having some troubles...

Take the example program here:

class MyFrame(wx.Frame):
   def __init__(self, *args, **kwds):
       wx.Frame.__init__(self, None, -1, "test")
       self.cb = wx.ComboBox(self, -1, style = wx.CB_READONLY)
       self.cb.Bind(wx.EVT_COMBOBOX, self.OnEvent)

       self.cb.Append("Blurb")
       self.cb.SetValue("Blurb")
       self.cb.Delete(0)
       print self.cb.GetValue()
       self.cb.Append("bla")

   def OnEvent(self, event):
       print 'CB_EVENT'
       print self.cb.GetValue()

class Application(wx.App):
   def OnInit(self):
       win = MyFrame(None, -1, "")
       win.Show(True)
       return True
   
# end of class MyFrame1
app = Application(0)
app.MainLoop()

Run it, and select the only entry in the combobox, and exit.

In my opinion, the outputput should be
"" (i.e. nothing selected)
CB_EVENT
Bla

But the output I get:

Blurb

This not only means, that the first print produces a wrong result (The
checkbox is empty, thus GetValue should return such), and second, I'm not
receiving the Checkbox event, because I don't get the CB_EVENT.
Any idea what causes this?
May be it's os-specific. I'm on Windows XP :frowning:

Thanks

--
Franz Steinhaeusler

Hi Franz

Hmm.. That's quite interesting. Unfortunatelly, it's not quite what I want
(ie, the dropdown list is editable). I've submitted a bug now.

Thanks
Benjamin

···

-----Ursprüngliche Nachricht-----
Von: news [mailto:news@sea.gmane.org] Im Auftrag von Franz Steinhäusler
Gesendet: Montag, 19. September 2005 10:46
An: wxpython-users@lists.wxwindows.org
Betreff: [wxPython-users] Re: Bug in Combobox?

On Thu, 15 Sep 2005 15:01:57 +0200, "Benjamin Schindler" <bschindler@student.ethz.ch> wrote:

Hi, I'm having some troubles...

Take the example program here:

class MyFrame(wx.Frame):
   def __init__(self, *args, **kwds):
       wx.Frame.__init__(self, None, -1, "test")
       self.cb = wx.ComboBox(self, -1, style = wx.CB_READONLY)
       self.cb.Bind(wx.EVT_COMBOBOX, self.OnEvent)

       self.cb.Append("Blurb")
       self.cb.SetValue("Blurb")
       self.cb.Delete(0)
       print self.cb.GetValue()
       self.cb.Append("bla")

   def OnEvent(self, event):
       print 'CB_EVENT'
       print self.cb.GetValue()

class Application(wx.App):
   def OnInit(self):
       win = MyFrame(None, -1, "")
       win.Show(True)
       return True
   
# end of class MyFrame1
app = Application(0)
app.MainLoop()

Run it, and select the only entry in the combobox, and exit.

In my opinion, the outputput should be
"" (i.e. nothing selected)
CB_EVENT
Bla

But the output I get:

Blurb

This not only means, that the first print produces a wrong result (The
checkbox is empty, thus GetValue should return such), and second, I'm not
receiving the Checkbox event, because I don't get the CB_EVENT.
Any idea what causes this?
May be it's os-specific. I'm on Windows XP :frowning:

Thanks

Hello Benjamin,

this seems to be a bug for me.
If I replace wx.CB_READONLY with wx.CB_DROPDOWN,
the sample works a expected.

--
Franz Steinhaeusler

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org