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

Author Topic: Is there any way to recognize the numpad period key?  (Read 4068 times)

0 Members and 1 Guest are viewing this topic.

timewarp

  • Newbie
  • *
  • Posts: 4
    • View Profile
Is there any way to recognize the numpad period key?
« on: June 27, 2011, 08:33:18 pm »
I'm trying to get text input from the user, so I need to be able to read in any key press and update a text field accordingly. When I try to read in the numpad period/delete key, the event always returns the key as 0 when numlock is on, but returns Delete when numlock is off. Any suggestions?

Edit: I'm using SFML 2.0 r5469

timewarp

  • Newbie
  • *
  • Posts: 4
    • View Profile
Is there any way to recognize the numpad period key?
« Reply #1 on: July 03, 2011, 10:35:11 am »
Bump.

timewarp

  • Newbie
  • *
  • Posts: 4
    • View Profile
Is there any way to recognize the numpad period key?
« Reply #2 on: July 08, 2011, 08:42:07 pm »
Bump.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Is there any way to recognize the numpad period key?
« Reply #3 on: July 08, 2011, 09:08:18 pm »
Key codes are currently badly handled in SFML, don't waste too much time if you get problems with key codes.
Laurent Gomila - SFML developer

Cuban-Pete

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Is there any way to recognize the numpad period key?
« Reply #4 on: July 08, 2011, 09:20:48 pm »
Use instead (?):

Code: [Select]

if (event.Type == sf::Event::TextEntered){

 if (event.Text.Unicode == 8 ){ //8 is 'enter' in this example

 ... do stuff...

 }
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Is there any way to recognize the numpad period key?
« Reply #5 on: July 08, 2011, 09:30:10 pm »
TextEntered event is a totally different thing, it provides characters rather than keyboard keys.
Laurent Gomila - SFML developer

timewarp

  • Newbie
  • *
  • Posts: 4
    • View Profile
Is there any way to recognize the numpad period key?
« Reply #6 on: July 09, 2011, 06:29:43 pm »
Quote from: "Laurent"
Key codes are currently badly handled in SFML, don't waste too much time if you get problems with key codes.

Ok, thanks.