Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site

SourceForge.net Logo



template <class DataType, class Base, class IncType = DataType>

class WithSpin : public Base



This template adds spin buttons to the Base widget to increment and decrement its value. Base musts be descendant of Ctrl and must have defined methods MinMax(DataType, DataType), GetMin and GetMax. DataType is a type of Value contained in Base, IncType type of increment value.

There two global function templates that can be used to customize increment/decrement process:  WithSpin_DefaultIncValue defines the default increment value and WithSpin_Add defines a way how the value is incremented or decremented.


Public Method List


WithSpin& SetInc(IncType _inc = 1)

Sets the increment value.



DataType GetInc() const

Returns current increment value.



WithSpin& OnSides(bool b = true)

Instead of putting both buttons at the right side of widget, puts decrement button to the left and increment to the right.



bool IsOnSides() const

True is OnSides is active.



WithSpin& ShowSpin(bool s = true)

Shows/hides spin buttons.



bool IsSpinVisible() const

Returns true if spin buttes are shown.



WithSpin& RoundFromMin(bool b = true)

If this option is active, increments are rounded with respect to minimum value. E.g. normally (when not active) if minimum value is 3, going up from the minimum goes through values 3, 5, 10, ..., which when RoundFromMin is active, it goes through 3, 8, 13, ...



SpinButtons& SpinButtonsObject()

const SpinButtons& SpinButtonsObject() const

Returns a reference to internal SpinButtons object.



Predefined WithSpin widgets


typedef WithSpin<int, EditIntEditIntSpin

typedef WithSpin<int64, EditInt64EditInt64Spin

typedef WithSpin<double, EditDoubleEditDoubleSpin

typedef WithSpin<Date, EditDate, intEditDateSpin

typedef WithSpin<Time, EditTime, intEditTimeSpin

typedef WithSpin<int, EditIntNotNullEditIntNotNullSpin

typedef WithSpin<int64, EditInt64NotNullEditInt64NotNullSpin

typedef WithSpin<double, EditDoubleNotNullEditDoubleNotNullSpin

typedef WithSpin<Date, EditDateNotNull, intEditDateNotNullSpin

typedef WithSpin<Time, EditTimeNotNull, intEditTimeNotNullSpin

These typedefs predefine common EditField based value editors with spin buttons.


Last edit by cxl on 05/01/2017. Do you want to contribute?. T++