How to get selection from a owner draw combobox?

I had an owner draw combobox in 2.9.1.1, and I used the GetSelection() method to get the currently selected item of it. In 2.9.4.0, though, GetSelection() gives me back a tuple, which is (I guess) the selected text in the combobox’s edit control (owner draw comboboxes don’t have an edit control).

So I’m wondering what the new correct method is for getting the currently selected item from an owner drawn combobox.

I’ve modified the owner draw combobox example from the wxpython demo slightly to show the problem. Look for the “ADDED TO DEMO” comments to see what I’ve added. This is in the 2.9.4.0 demo.

cb_demo.py (5.41 KB)

And I guess the same question for SetSelection. That doesn’t seem to work any more either.

No one else sees similar behavior? :frowning: What is wxPython supposed to do if there are two implementations of the same member function in a class?

I've made a fix to better disambiguate the [G|S]etSelection methods so it will use the ones inherited from wx.ItemContainer instead of the ones from wx.TextEntry. This will be in the next 2.9.5 preview build, keep an eye on wxPython-dev for an announcement of when that is done. (Probably not until the weekend, at least.)

···

On 1/15/13 8:12 AM, dhyams wrote:

I had an owner draw combobox in 2.9.1.1, and I used the GetSelection()
method to get the currently selected item of it. In 2.9.4.0, though,
GetSelection() gives me back a tuple, which is (I guess) the selected
text in the combobox's edit control (owner draw comboboxes don't have an
edit control).

So I'm wondering what the new correct method is for getting the
currently selected item from an owner drawn combobox.

I've modified the owner draw combobox example from the wxpython demo
slightly to show the problem. Look for the "ADDED TO DEMO" comments to
see what I've added. This is in the 2.9.4.0 demo.

--
Robin Dunn
Software Craftsman

In Classic we try to avoid it by renaming methods. In Phoenix we can leave them alone in most cases because it has very good support for overloading and resolving the overloads at the time the method is called. In this case however the problem was due to multiple inheritance and the same method name being in two branches of the class ancestry, and with the way Python's MRO works it was finding the wrong implementation of [S|G]etSelection first.

···

On 1/16/13 2:56 PM, dhyams wrote:

No one else sees similar behavior? :frowning: What is wxPython supposed to do
if there are two implementations of the same member function in a class?

--
Robin Dunn
Software Craftsman

Thanks so much Robin! Is the fix in a publically available svn
somewhere? I could snag it and test it out.

···

On Wed, Jan 16, 2013 at 7:57 PM, Robin Dunn <robin@alldunn.com> wrote:

On 1/16/13 2:56 PM, dhyams wrote:

No one else sees similar behavior? :frowning: What is wxPython supposed to do
if there are two implementations of the same member function in a class?

In Classic we try to avoid it by renaming methods. In Phoenix we can leave
them alone in most cases because it has very good support for overloading
and resolving the overloads at the time the method is called. In this case
however the problem was due to multiple inheritance and the same method name
being in two branches of the class ancestry, and with the way Python's MRO
works it was finding the wrong implementation of [S|G]etSelection first.

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Daniel Hyams
dhyams@gmail.com

It's the last two changes at wxTrac has been migrated to GitHub Issues - wxWidgets

···

On 1/16/13 5:57 PM, Daniel Hyams wrote:

Thanks so much Robin! Is the fix in a publically available svn
somewhere? I could snag it and test it out.

--
Robin Dunn
Software Craftsman

Again, thanks much…I should have looked there first; I just figured that it was hidden away in a branch somewhere. Sorry about that.

One last little Q if I may…the page here Phoenix/README.rst at master · wxWidgets/Phoenix · GitHub says that there is a windows SWIG binary available, but the link that it points to is dead. Does that binary exist somewhere that it can be nabbed?

···

On Wednesday, January 16, 2013 9:38:05 PM UTC-5, Robin Dunn wrote:

On 1/16/13 5:57 PM, Daniel Hyams wrote:

Thanks so much Robin! Is the fix in a publically available svn

somewhere? I could snag it and test it out.

It’s the last two changes at http://trac.wxwidgets.org/log/wxPython/trunk


Robin Dunn

Software Craftsman

http://wxPython.org

It is now located at http://wxpython.kosoftworks.com/tools/

···

On 1/16/13 7:29 PM, dhyams wrote:

Again, thanks much...I should have looked there first; I just figured
that it was hidden away in a branch somewhere. Sorry about that.

One last little Q if I may...the page
here Phoenix/README.rst at master · wxWidgets/Phoenix · GitHub says that there is a windows
SWIG binary available, but the link that it points to is dead. Does
that binary exist somewhere that it can be nabbed?

--
Robin Dunn
Software Craftsman

Thanks yet again, and I do apologize for yet another follow-up question.

I got wxPython from svn, but what wxWidgets do I pair it up with? I looked through the tags for wxWidgets, but did not see anything appropriate.

···

On Wednesday, January 16, 2013 10:46:10 PM UTC-5, Robin Dunn wrote:

On 1/16/13 7:29 PM, dhyams wrote:

Again, thanks much…I should have looked there first; I just figured

that it was hidden away in a branch somewhere. Sorry about that.

One last little Q if I may…the page

here http://www.wxpython.org/BUILD.html says that there is a windows

SWIG binary available, but the link that it points to is dead. Does

that binary exist somewhere that it can be nabbed?

It is now located at http://wxpython.kosoftworks.com/tools/


Robin Dunn

Software Craftsman

http://wxPython.org

Sometimes they can get a bit out of sync, but most of the time using wxWidgets trunk with wxPython trunk will work. If there are build problems then you can try moving your wxWidgets tree back to the same day/time of the latest wxPython commit.

···

On 1/17/13 7:52 AM, dhyams wrote:

Thanks yet again, and I do apologize for yet another follow-up question.

I got wxPython from svn, but what wxWidgets do I pair it up with? I
looked through the tags for wxWidgets, but did not see anything appropriate.

--
Robin Dunn
Software Craftsman