SpinCtrl with empty value?

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
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

SpinCtrl with empty value?

Post by MoonKid » Sat Apr 25, 2015 2:02 pm

Does the SpinCtrl allow and empty value? I mean the text field is empty.

DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 223
Joined: Mon Jan 19, 2015 1:45 pm

Re: SpinCtrl with empty value?

Post by DenDev » Sat Apr 25, 2015 2:24 pm

Have you tried to set a validator to the spinctrl?

Code: Select all

wxIntegerValidator<int> intval;
intval.SetStyle(wxNUM_VAL_ZERO_AS_BLANK);
spinctrl->SetValidator(intval);
This should allow empty value to be set/get as "0" - otherwise I do not think an empty value is allowed.
I have a bad habbit of not testing the code I post :D

MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

Re: SpinCtrl with empty value?

Post by MoonKid » Sat Apr 25, 2015 2:40 pm

This isn't full implemented in wxPython/wxPhoenix.

And it is a workaround.

An empty value is NULL/None/the-definied-nothing.
'0' or 0 is a value.

This is a big difference and I want my gui to display that.

Post Reply