Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How do I make a text box which only accepts numbers?  (Read 7394 times)

0 Members and 1 Guest are viewing this topic.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: How do I make a text box which only accepts numbers?
« Reply #15 on: December 11, 2018, 06:21:19 pm »
OK I see your points; but if it were me, just for simplicity's sake, I would just paste this one line of code into pollEvents() function for 0 to 9 and be done with it.

case sf::Keyboard::Num0: case sf::Keyboard::NumPad0: objTextBox.input(0); break;
That is not beautiful. You really should use events in this case, but I guess it's up to you.

This may shock you but pollEvents() polls events  :P

Kanoha

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: How do I make a text box which only accepts numbers?
« Reply #16 on: December 11, 2018, 10:59:03 pm »


This may shock you but pollEvents() polls events  [emoji14]

Yeah of course, and it is also encapsulated for a reason.

Sent from my SM-G950F using Tapatalk


NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: How do I make a text box which only accepts numbers?
« Reply #17 on: December 14, 2018, 08:59:32 am »


This may shock you but pollEvents() polls events  [emoji14]

Yeah of course, and it is also encapsulated for a reason.

Sent from my SM-G950F using Tapatalk

I don't get your point.

ps I'm not too smart.