Doubt about TextBox and Input data

Get help using Construct 2

Post » Sat Feb 08, 2014 12:21 am

I would like to know how to make a TextBox act as an input just to certain extent. Let's say that I only want to take float numbers from 0.00 to 10.00, and while they are being typed by the user into the box, I want it to show not more than two decimals and no other numbers but these between those limits.

So, if I write 5.04 in the textbox will be shown 5.04
If........     5.04564 in the textbox will be shown 5.04
If........    H5.00023 in the textbox will be shown nothing due it's not a number.
If........    45.4523 in the textbok will be shown 10.00, due it's the max value of the rank I would define.

Any idea on how to implement this?

By now I'm using these instructions:

clamp(float(replace(TextBox.Text,",",".")),0,10)

But it seems only useful in order to avoid the problem of using commas instead of dots and to define the limits of my desired rank...

Any help would be welcome. With this effort we could better the way construct takes data, and perhaps create a good tutorial.
B
17
S
4
G
1
Posts: 105
Reputation: 1,874

Return to How do I....?

Who is online

Users browsing this forum: guannstar, nahima and 22 guests