wxComboBox - difference between GetStringSelection() and GetValue()

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Forbin
Earned a small fee
Earned a small fee
Posts: 21
Joined: Mon Oct 31, 2016 7:26 pm

wxComboBox - difference between GetStringSelection() and GetValue()

Post by Forbin »

Forgive this somewhat noob-ish question, but what's the difference in behavior between the GetStringSelection() and GetValue() functions on wxComboBox?

Does this vary by platform?

(I've RTFM'ed -- the documentation wasn't really clear. And I've delved into the source code a bit, but the actual implementation details seem to be buried a little deeper than I have time for right now. I'm asking mostly just to be cautious in case I'm setting myself up for a problem.)

I only have to compile for MS Windows and Mac OSX (cocoa) --- but if you know there's a difference for another OS, please post it here anyway since it will likely be helpful to another reader at some point.


Thanks!!
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxComboBox - difference between GetStringSelection() and GetValue()

Post by doublemax »

For this particular control there is no difference. If you look at the class diagram for wxComboBox you see that it derives from wxTextEntry and wxItemContainerImmutable.
http://docs.wxwidgets.org/trunk/classwx_combo_box.html

wxTextEntry::GetValue() gets the current value of the text control.
wxItemContainerImmutable::GetStringSelection() gets the currently selected string.

For a wxComboBox these happen to be the same.
Use the source, Luke!
Post Reply