Combobox error on windows

Chetan Thapliyal wrote:

Hi list

Can anyone tell me whats wrong with this code:

        self.activity_combo = wx.ComboBox(self, -1, choices=, style=wx.CB_DROPDOWN)
        activities = db.getData('.\\data\\activities.xml', 'activity')
        activities = activities.values()
        self.activity_combo.Create(self, choices=activities)
        self.activity_combo.SetSelection(0)

I am getting the following error while executing the code on windows:

    return _controls_.ComboBox_Create(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "!m_oldWndProc" failed in ..\..\src\msw
\window.cpp(993): subclassing window twice?

You can't call Create on a UI object that is already created. The Create method is for when you use the 'Pre*' factory functions for creating an instance object without creating the UI object at the same time. For example:

  self.activity_combo = wx.PreComboBox()
  ...
  self.activity_combo.Create(self, choices=activities)

···

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

Hi Robin

Thanks a lot for your quick and valuable assistance.

regards
Chetan

···

On 1/3/06, Robin Dunn robin@alldunn.com wrote:

Chetan Thapliyal wrote:

Hi list

Can anyone tell me whats wrong with this code:

    self.activity_combo = wx.ComboBox(self, -1, choices=[],

style=wx.CB_DROPDOWN)
activities = db.getData(‘.\data\activities.xml’, ‘activity’)
activities = activities.values()
self.activity_combo.Create(self, choices=activities)
self.activity_combo.SetSelection(0)

I am getting the following error while executing the code on windows:

return _controls_.ComboBox_Create(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “!m_oldWndProc” failed in

…..\src\msw
\window.cpp(993): subclassing window twice?

You can’t call Create on a UI object that is already created. The
Create method is for when you use the ‘Pre*’ factory functions for

creating an instance object without creating the UI object at the same
time. For example:

    self.activity_combo = wx.PreComboBox()
    ...
    self.activity_combo.Create(self, choices=activities)


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


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