Add digits property to wxSpinCtrlDoubleXmlHandler
This makes it possible to set the precision of the number without changing the increment amount. Closes #22470.
This commit is contained in:
committed by
Vadim Zeitlin
parent
d9f36adc8f
commit
6ce81acda8
@@ -2088,6 +2088,8 @@ additional property:
|
|||||||
@beginTable
|
@beginTable
|
||||||
@row3col{inc, float,
|
@row3col{inc, float,
|
||||||
The amount by which the number is changed by a single arrow press.}
|
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
|
@endTable
|
||||||
|
|
||||||
@since 3.1.1.
|
@since 3.1.1.
|
||||||
|
|||||||
@@ -1512,7 +1512,8 @@ wxSpinCtrlDouble =
|
|||||||
[xrc:p="o"] element value {_, t_float }* &
|
[xrc:p="o"] element value {_, t_float }* &
|
||||||
[xrc:p="o"] element min {_, t_float }* &
|
[xrc:p="o"] element min {_, t_float }* &
|
||||||
[xrc:p="o"] element max {_, 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}*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ static const long DEFAULT_VALUE = 0;
|
|||||||
static const long DEFAULT_MIN = 0;
|
static const long DEFAULT_MIN = 0;
|
||||||
static const long DEFAULT_MAX = 100;
|
static const long DEFAULT_MAX = 100;
|
||||||
static const int DEFAULT_INCREMENT = 1;
|
static const int DEFAULT_INCREMENT = 1;
|
||||||
|
static const int DEFAULT_DIGITS = 0;
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxSpinButtonXmlHandler, wxXmlResourceHandler);
|
||||||
|
|
||||||
@@ -140,6 +141,10 @@ wxObject *wxSpinCtrlDoubleXmlHandler::DoCreateResource()
|
|||||||
double(GetFloat(wxS("inc"), DEFAULT_INC)),
|
double(GetFloat(wxS("inc"), DEFAULT_INC)),
|
||||||
GetName());
|
GetName());
|
||||||
|
|
||||||
|
int digits = GetLong("digits", DEFAULT_DIGITS);
|
||||||
|
if (digits != DEFAULT_DIGITS)
|
||||||
|
control->SetDigits(digits);
|
||||||
|
|
||||||
SetupWindow(control);
|
SetupWindow(control);
|
||||||
|
|
||||||
return control;
|
return control;
|
||||||
|
|||||||
Reference in New Issue
Block a user