diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index e5178a13d9..d73566c25a 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -2088,6 +2088,8 @@ additional property: @beginTable @row3col{inc, float, The amount by which the number is changed by a single arrow press.} +@row3col{digits, integer, + Sets the precision of the value of the spin control (default: 0). @since 3.1.7.} @endTable @since 3.1.1. diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index b38c47f651..fdff4eca62 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -1512,7 +1512,8 @@ wxSpinCtrlDouble = [xrc:p="o"] element value {_, t_float }* & [xrc:p="o"] element min {_, t_float }* & [xrc:p="o"] element max {_, t_float }* & - [xrc:p="o"] element inc {_, t_float}* + [xrc:p="o"] element inc {_, t_float}* & + [xrc:p="o"] element digits {_, t_integer}* } diff --git a/src/xrc/xh_spin.cpp b/src/xrc/xh_spin.cpp index 6bd3c4a9e9..1e387ccdfb 100644 --- a/src/xrc/xh_spin.cpp +++ b/src/xrc/xh_spin.cpp @@ -23,6 +23,7 @@ static const long DEFAULT_VALUE = 0; static const long DEFAULT_MIN = 0; static const long DEFAULT_MAX = 100; static const int DEFAULT_INCREMENT = 1; +static const int DEFAULT_DIGITS = 0; wxIMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler); @@ -140,6 +141,10 @@ wxObject *wxSpinCtrlDoubleXmlHandler::DoCreateResource() double(GetFloat(wxS("inc"), DEFAULT_INC)), GetName()); + int digits = GetLong("digits", DEFAULT_DIGITS); + if (digits != DEFAULT_DIGITS) + control->SetDigits(digits); + SetupWindow(control); return control;