SFML community forums

Help => Window => Topic started by: timewarp on June 27, 2011, 08:33:18 pm

Title: Is there any way to recognize the numpad period key?
Post by: timewarp 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
Title: Is there any way to recognize the numpad period key?
Post by: timewarp on July 03, 2011, 10:35:11 am
Bump.
Title: Is there any way to recognize the numpad period key?
Post by: timewarp on July 08, 2011, 08:42:07 pm
Bump.
Title: Is there any way to recognize the numpad period key?
Post by: Laurent 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.
Title: Is there any way to recognize the numpad period key?
Post by: Cuban-Pete 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...

 }
}
Title: Is there any way to recognize the numpad period key?
Post by: Laurent on July 08, 2011, 09:30:10 pm
TextEntered event is a totally different thing, it provides characters rather than keyboard keys.
Title: Is there any way to recognize the numpad period key?
Post by: timewarp 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.