How do I create a plus/minus button to control a number in text box

Wanted to create a button that can add number in text box. For example. I have a text start with number 0. Once i press add button then number will increase to 1 and it goes on.

  1. Create a blueprint widget
  2. Add a text box
  3. Add a button
  4. Scroll down the details panel to “Events”
  5. Add a “OnClicked” event
  6. Create a public Integer variable
  7. Drag a node of OnClicked and add a SetText(Text Box) function
  8. Connext its target to you textbox object
  9. Drag you Integer variable into the field
  10. Set its value “+1” by using the “Integer + Integer” function

Thats it

Hi, you want to add 2 buttons and a Text object (set this one to “Is Variable”) to a widget. Then use the OnClicked Event of the buttons to change the Text value, something like this:

76812-1.jpg

76814-3.jpg

Regards.

Thanks for the answer

Thanks for the clear answer!
What if I want to set a certain number? Let say first click value is 1, second click is value 5, third click value is 10.

Use a branch between the last node and the operator ("+" or “-”) to check for the textbox condition. If its bigger than 1, set the true node to +5 otherwise the false to +1.

Well, depend if those will be fixed numbers you will need to add cases, like in atatch (note also i added an Integer Variable called AuxInt), but if your sucesions have some logic like 1>3>5>7>9>11 etc then you could do the maths and code more general.

Regards.