Integer spin box? Other text field?
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?
asked Dec 24 '15 at 10:42 PM in Using UE4
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
answered Feb 12 '16 at 08:00 PM
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:
The handle functions:
The shared pointer:
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.
answered Aug 29 '17 at 12:12 AM
answered May 13 '19 at 12:38 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here