On 6 Sep 2009, at 8:20, Tomas Bym wrote:

> here is tho code greg proposed. I made couple changes, but htey  
> don't affect this input behavior. The only change in the code is at  
> the place where you check for the key value. I found that the key  
> value at the numberical keyboard is 65456 for 0 and 65465 for 9  
> (65454 is for .). With this little change the code allows the input  
> and display it well in the widget, but when I send the cmd as a  
> arguement of some function I recieve some wrong characters instead  
> of the numbers(±˛ł´µ¶·¸ą - this is the output of  
> 123456789). I am using VS2008 on XP.

Ah, right. Decoding keys from the numeric keypad... You need to take  
account of the modifier bits... I'm not sure if/where all this is  
documented, but take a look a Enumerations.H, you will see that the  
key handling includes all manner of modifier bits, including modifier  
bits for handling input values form the keypad.

#define FL_KP           0xff80 // use FL_KP+'x' for 'x' on numeric keypad
#define FL_KP_Enter     0xff8d // same as Fl_KP+'\r'
#define FL_KP_Last      0xffbd // use to range-check keypad

Now, lets take the values you read in, say 65456 and express that in  
hex, it's 0xFFB0, which is the same as FL_KP + 0x30. And 0x30 is the  
ASCII code for 0.

Similarly 65456 is hex 0xFFB9 - or FL_KP + 0x39...

And I guess you can figure out the rest from there. You can check if  
your value lies between FL_KP and FL_KP_LAST and if it does,  
subtracting FL_KP will (usually!) return the value you actually wanted!

-- 
Ian









_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to