Search code examples
c++qtcomboboxwxwidgets

Find the Previous and Selected Value of a wxComboBox


I'm coming from Qt trying to learn wxWidgets.

When a user selects an element from a wxComboBox I want to get the value that is being changed from and the value that is being changed to. I need to be able to change some other elements in my GUI in reaction to the previous and selected values.

In Qt I would have had to override the QComboBox and create my own signal. This example is a little overkill because the user cannot type into my combobox, nor can he add elements, but you get the idea: https://stackoverflow.com/a/3184619/2642059

Is there a way to accomplish this in wxWidgets? Or do I just have to maintain a variable holding the previous value and update that after each user selection?


Solution

  • Yes, you will need to remember the last selection yourself, wxWidgets doesn't do it for you (and neither does the native control).