ComboBox wxCB_READONLY problem

Hi all,

I have problems building readonly wxComboBox. I write the following:
[...]
combo = wxComboBox(self, -1, "", wxPoint(10,10), wxSize(10,10), self.sampleList, style = wxCB_READONLY | wxCB_DROPDOWN)
[...]
In wxPython 2.3 that works fine but in 2.4 it gives me wxAssertionFailure: invalid string in wxChoice::SetStringSelection!

What should I do?

BTW, the next code works fine:
[...]
combo = wxComboBox(self, -1, "", wxPoint(10,10), wxSize(10,10), self.sampleList, style = wxCB_DROPDOWN)
[...]
both in wxPython 2.3 and wxPython 2.4 (it is the same code line without the wxCB_READONLY)

Thanx

Ilia Kats wrote:

Hi all,

I have problems building readonly wxComboBox. I write the following:
[...]
combo = wxComboBox(self, -1, "", wxPoint(10,10), wxSize(10,10), self.sampleList, style = wxCB_READONLY | wxCB_DROPDOWN)
[...]
In wxPython 2.3 that works fine but in 2.4 it gives me wxAssertionFailure: invalid string in wxChoice::SetStringSelection!

What should I do?

You need to set the value to one of the items in the list, rather than "".

ยทยทยท

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