# Widget slider and integer

**URL:** <https://forums.unrealengine.com/t/widget-slider-and-integer/463581>\
**Category:** UI\
**Tags:** unreal-engine, Widget, question\
**Created:** [April 10, 2020, 2:11pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581 "2020-04-10T14:11:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![KAT\_Editor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KAT\_Editor](https://forums.unrealengine.com/u/KAT_Editor)\
**Post date:** [April 10, 2020, 2:11pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/1 "2020-04-10T14:11:18Z")

</div>

Hello, I convert float from slider to integer for display it as text, but got a problem. “Step size” set to 0.1, “mouse uses step” enabled, when I move slider to right I get 0 10 20 30 40 50 60 70 80 90 100, but when I move slider to lift, I get 100 90 79 69 59 49 39 29 19 9 0. How fix it?

 ![299415-sliderint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/5/1d5696bdceda7286c6c32c6028b8e1981aafbcf9.png)

 ![299416-sliderint2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/3/7a3d57f3c5378dff8c8c3e3e0d994769f7bae8c4.png)

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [April 11, 2020, 6:32pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/2 "2020-04-11T18:32:46Z")

</div>

I believe truncate always rounds down,. It’s just the way C++ does math. I think there’s a function called Ceil that rounds it up.

If that won’t work. You can get the current value and check if the new value is greater or less then the original value and plug that in a branch, have one side add 1 (unless the value is 0 or100) and the other side stay the same

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [April 11, 2020, 6:39pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/3 "2020-04-11T18:39:13Z")

</div>

And to get the old value,. Make a float called oldvalue and at the end After you set the sound volume, drag the volume pin all the way in the end into a set old value node

---

<div class="post-metadata">

**Author:** ![KAT\_Editor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KAT\_Editor](https://forums.unrealengine.com/u/KAT_Editor)\
**Post date:** [April 12, 2020, 8:40pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/4 "2020-04-12T20:40:20Z")

</div>

Hello, I add “+0.1” after “x100” and integer show 0 10 20 30 40 50 60 70 80 90 100 90 80 70 60 50 40 30 20 10 0. But step size is 0,1 and mouse uses spteps, is 9, …,79 a bug?

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [April 12, 2020, 10:36pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/5 "2020-04-12T22:36:09Z")

</div>

its not a bug, i think thats just how C++ does math, when you convert an integer to a float i think it always rounds down

---

<div class="post-metadata">

**Author:** ![KAT\_Editor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KAT\_Editor](https://forums.unrealengine.com/u/KAT_Editor)\
**Post date:** [April 13, 2020, 7:20am UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/6 "2020-04-13T07:20:00Z")

</div>

But float have 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 0,9 0,8 0,7 0,6 0,5 0,4 0,3 0,2 0,1 0,0 value with that settings. From where comes 79, …, 9 ?

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [April 13, 2020, 10:06pm UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/7 "2020-04-13T22:06:55Z")

</div>

idk but just do something like this  
if (NUMBER % 10 != 0) { number ++}  
but you know instead of an if statement use a branch

---

<div class="post-metadata">

**Author:** ![KAT\_Editor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KAT\_Editor](https://forums.unrealengine.com/u/KAT_Editor)\
**Post date:** [April 25, 2020, 6:49am UTC](https://forums.unrealengine.com/t/widget-slider-and-integer/463581/8 "2020-04-25T06:49:52Z")

</div>

Its a bug [Unreal Engine Issues and Bug Tracker (UE-92452)](https://issues.unrealengine.com/issue/UE-92452) , not critical bug, as I say before, just add +0.1 after \*100 and this fix it.
