Spin news
Posted on by Vadim Zeitlin
I’ve recently needed to add a small new feature to wxSpinCtrl: possibility to
display and enter the numbers in hexadecimal format. This is done now with the
addition of SetBase() method, so now you can either call SetBase(16)
explicitly in the code or use “base” XRC property by adding <base>16</base>
to your XRC files (this needs to be done manually as dialog editors don’t have
support for it yet). Just in case you’re curious, here is how the new control
looks in the updated widgets sample under OS X:
But as a side effect of working on this, I’ve also fixed a few other bugs in
wxSpinCtrl
, hence this progress report:
- First, I’ve simply removed wxOSX version of this control. Strangely enough, we had a generic implementation of it for wxOSX which was different from another generic implementation used for all other platforms. They were not identical but pretty similar and at least now we only have one version to maintain.
- Next I fixed the funny bug with contents of the control being shown as
password field if
wxALIGN_CENTRE
was used. Even though it’s more correct to usewxTE_CENTRE
, it’s more user-friendly to support both versions, especially as the documentation was rather confusing on this subject until recently. - I also added the generation of
wxEVT_COMMAND_TEXT_ENTER
to the generic wxSpinCtrl which didn’t send them at all before. This fixed another bug as generic wxSpinCtrl was also used for wxSpinCtrlDouble under wxMSW, and so this event wasn’t sent when using real-valued spin controls under Windows, even though it was sent with integer-valued ones. - But integer-valued Windows wxSpinCtrl was not without problems neither: the
value carried by its events wrapped over when it was greater than
SHRT_MAX
, i.e. 32767. So I fixed this as well.
There are still some bugs left in wxSpinCtrl, e.g. settings colours doesn’t work correctly in the generic version but it’s in a much better shape now than only a few days ago.