# Integer spin box? Other text field?

**URL:** <https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371>\
**Category:** UI\
**Tags:** text, integer, unreal-engine, UI, Widget, question\
**Created:** [December 24, 2015, 10:42pm UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371 "2015-12-24T22:42:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oranjoose](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Oranjoose](https://forums.unrealengine.com/u/Oranjoose)\
**Post date:** [December 24, 2015, 10:42pm UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/1 "2015-12-24T22:42:42Z")

</div>

Simple question: is there a setting to make spin boxes only permit integers?

I’m looking to make a text field that only takes integers.

I know I can do a quick absolute value in the on commit event, but it still displays the point 0 since it is a float.

Any good solution here?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9f67398f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9f67398f](https://forums.unrealengine.com/u/anonymous_user_9f67398f)\
**Post date:** [February 12, 2016, 8:00pm UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/2 "2016-02-12T20:00:15Z")

</div>

I don’t believe the spin box supports integer display. A compromise is to set the ‘slider delta’ to 1. However, it will still display a trailing .0

---

<div class="post-metadata">

**Author:** ![TheGreenMat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheGreenMat](https://forums.unrealengine.com/u/TheGreenMat)\
**Post date:** [August 29, 2017, 12:12am UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/3 "2017-08-29T00:12:52Z")

</div>

You can do this by creating your own version of USpinBox in C++. Start by creating a C++ class with base UWidget, and copy over the contents of USpinBox.h and USpinBox.cpp to your respective new files. Then, change a few key areas of the spin box code to use int32 instead of float. Some of these key areas include the following.

The dynamic multicast delegates:

```

    DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnIntSpinBoxValueChangedEvent, int32, InValue);
    	DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIntSpinBoxValueCommittedEvent, int32, InValue, ETextCommit::Type, CommitMethod);
    	DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIntSpinBoxBeginSliderMovement);

```

The handle functions:

```
void HandleOnValueChanged(int32 InValue);
	void HandleOnValueCommitted(int32 InValue, ETextCommit::Type CommitMethod);
	void HandleOnBeginSliderMovement();
	void HandleOnEndSliderMovement(int32 InValue);

```

The shared pointer:

```
TSharedPtr<SSpinBox<int32>> MySpinBox;

```

A few more similar changes must be made in the .cpp file, but they all come down to changing floats to int32 where needed. Finally, make sure you set your spin box delta to 1.

---

<div class="post-metadata">

**Author:** ![Two-faced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Two-faced](https://forums.unrealengine.com/u/Two-faced)\
**Post date:** [May 13, 2019, 12:38pm UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/4 "2019-05-13T12:38:47Z")

</div>

> **[UE4.16 (preview 3): UMG- unable to set spinbox delta value](https://forums.unrealengine.com/questions/599292/ue416-preview-3-umg-unable-to-set-spinbox-delta-va.html)**
>
> When setting the delta value of a UMG spin box it has no effect. If I set it to a value of 1, then run the project and drag the slider with my mouse it doesn't snap to whole numbers as I would expect. Let me know if you need any further...

---

<div class="post-metadata">

**Author:** ![ReclusiveRychu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ReclusiveRychu](https://forums.unrealengine.com/u/ReclusiveRychu)\
**Post date:** [July 11, 2019, 2:20pm UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/5 "2019-07-11T14:20:13Z")

</div>

Hey! So I had the same problem and solved it by modifying the original spin box! Hope this helps!

[https://forums.unrealengine.com/development-discussion/content-creation/1641116-creating-an-integer-spin-box-for-widget](https://forums.unrealengine.com/development-discussion/content-creation/1641116-creating-an-integer-spin-box-for-widget)

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [December 3, 2023, 7:43am UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/6 "2023-12-03T07:43:18Z")

</div>

in… 5.3 fractional part is hidden if both max and min fractional digits are set to zero

---

<div class="post-metadata">

**Author:** ![ur-yantao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ur-yantao](https://forums.unrealengine.com/u/ur-yantao)\
**Post date:** [June 12, 2025, 6:59am UTC](https://forums.unrealengine.com/t/integer-spin-box-other-text-field/342371/7 "2025-06-12T06:59:57Z")

</div>

New bee!  
By the way UE widgt module is a ■■■■!
