Integer SpinBox

Hi there! :slight_smile:

Could we please have a data type option within the properties of the SpinBox within UMG to select the numerical data type, so we could choose to use Integers or Float values?
Either that, or could we have a seperate SpinBox(int) class? (I would imagine this would be the easier option for you guys).

I will be looking at how to do this myself, as I do need to learn about creating my own blueprint nodes in C++ and my own C++ classes to use in my project.

I make this request because there are certain things within the UI, such as setting a date (dd/mm/yyyy) where float values would not be suitable, but a spin box would be perfect.

I did try to create my own C++ class that derived from the SpinBox class, but it failed, the source needed rebuilding (or something like that), then when I restarted the editor, I had a missing UE4Editor-“name”.dll module, so tried to rebuild in visual and do steps provided on Answerhub, but kept failing, so I gave up on that idea pretty quickly :frowning:

Thank you in advance :slight_smile:

Bumpity bump

[=DatapawWolf;382118]
Bumpity bump
[/]

Hi DatapawWolf,

Please do not bump threads that have not gone unanswered for 4 or more days from the most recent post. This clutters the forums and makes it more difficult to parse through.

UMG is Slate based (i susspect you talking about UMG), so you will need to include “Slate” and “SlateCore” (or just adding UMG module it enouth?) in to dependencies in you build script of your module. It also means, it is cleaner to create your own USpinBox instead of deriving it, because you UMG widgets operates Slate widget (in this case SSpinBox), so instead conflicting with existing code in USpinBox, it better to operate SSpinBox from the clean UMG widget. So look up how USpinBox is constructed and build UIntegerSpinBox which will operate SSpinBox with integer

https://github.com/EpicGames/UnrealEngine/blob/8a80b5541f69a79abf5855668f39e1d643717600/Engine/Source/Runtime/UMG/Private/Components/SpinBox.cpp
https://github.com/EpicGames/UnrealEngine/blob/8a80b5541f69a79abf5855668f39e1d643717600/Engine/Source/Runtime/UMG/Public/Components/SpinBox.h

I don’t know if it will be too complex for you, but it a worth a try, you can learn something from this challenge (like using Slate)

^ What said. We’re not going to provide every possible widget users will want. I expect over time, there will end up being a “UMG Bonus Widgets” community project that starts up with loads of custom Slate widgets and UWidget wrappers for them on GitHub crosses fingers.

A very easy way around your problem is to set the spin box delta to 1 (so it will only show 1) and when you need to get the value, use the round node so the number rounds up or down.

@anonymous_user_f5a50610
Thank you for your reply.
You are correct in that right now, taking a look at what you wrote, it seems complex, but I think it will make sense once I try to create the spinbox myself.
I really look forward to learning how to create my own blueprint nodes and classes etc within C++ as I believe it gives a much larger element of control to a project.
But for now, I have bigger tasks to handle before I get into the intricacies.

@NickDarnell
That is understandable, I can’t even Fathom the amount of work that has gone into creating UE4 for us, it’s just mind blowing.
I agree that I think in time there will be plenty to come out of the community that will benefit everyone. I would love to be part of that contribution, but I can’t help but feel that I am still very much an amateur that needs his hand held :stuck_out_tongue:

[=Death wyrm;390645]
A very easy way around your problem is to set the spin box delta to 1 (so it will only show 1) and when you need to get the value, use the round node so the number rounds up or down.
[/]

It is not very good for creating a system where the player can choose a date. The dates would look like “2.05.0/0.04.0/1.09.08.08.0” instead of “25/04/1988”.
Changing the delta and/or slider exponent doesn’t fix how the number is displayed, nor does using Floor or Ceiling on the number within the blueprint editor.

Delta set to 1.0 was not working for me so this is the fix I came up with. I create a variable and Bind it to the value. Then when the value is changed I use snap to grid and update the variable.

Hey guys, so I was having the same problem, and finally found the solution. I just modified the original spin box. Here ya go!

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

For anyone searching this nowadays, you can use the following settings to make your SpinBox use integer values :

slider.png

2 Likes

Very simple solution - works for me… Found it here: UE4.16 (preview 3): UMG- unable to set spinbox delta value - UI - Epic Developer Community Forums