HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: text input that allows only positive numerical characters typed in  (Read 1618 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile

Hi!

As the title says, what would be the easiest way to accomplish this?

Best regards
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.

I believe you would want to use the _numericInputBox control. Its class is GUINumericField which has a field to force input to be an integer and you can set a valid range for it. That's if you only want a box; if you want up/down arrow buttons as well then use _numericField.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile

Thanks, it was just the thing i was looking for. But, i noticed that it places the integer in the upper right corner of the control. I'm struggling to find a way to place it in the bottom left corner, just like the ordinary text input box does. Any idea how to do this?
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.

Not directly, but you can try different fonts, font size (I think), and I believe there is a field which is something like offset or something that seems to move the text around, but it is not easy to really get it where you want ala the justification of normal text boxes.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile

Blah, i ended up using a plain text input box and forcing a number on it with HE_onKeyUp and HE_onLostFocus. It's not perfect, but it fits my needs better then the numerical input.
Logged