Search code examples
c++wxwidgets

Using E notation in wxSpinCtrlDouble


In a C++ wxWidgets GUI, I am trying to implement a way for the user to change the value of an optimization problem parameter. The value has only meaningful impact on the problem if it changes by an order of magnitude. So the most convenient way to do it would be to display the current value in E notation (e.g., 1e-3) in a spin control and use an increment that is an order of magnitude, so that each click on the up or down arrow increases or decreases the exponent by one.

I am struggling to figure out how to do that. The wxSpinCtrlDouble requires a constant increment, as far as I can tell, so I cannot write something like "times 10".

But I feel like this is a common use case, so there should be a simple way to do it. Can anyone nudge me in the right direction?


Solution

  • There is no built-in way to do it, other than the obvious one: use wxSpinCtrl for just the exponent and a separate control (or maybe even a static 1) for the mantissa.