Doubt about TextBox and Input data

0 favourites
  • 1 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)