Hey guys,
Can someone tell me why it's not possible to check if + or - is pressed in CHARTEVENT_KEYDOWN?
It doesn't work with if (lparam=='+') and it doesn't work with if (lparam==char(189)) either. But why?
How can I check if these keys are pressed?
You are doing
(lparam==(char)189)
but it should be:
(lparam == (int)187)
Integers represent hexadecimal numbers not char.
I just tried and tested it and 187 is correct for the '+'.
How I found this keydown code: https://www.w3.org/2002/09/tests/keys.html
You are doing
but it should be:
Integers represent hexadecimal numbers not char.
I just tried and tested it and 187 is correct for the '+'.
How I found this keydown code: https://www.w3.org/2002/09/tests/keys.html
Thank you very much! (int) works.
I wonder why because when I just use Print(lparam) the result is 187 for the + key.
When I press ESC the result is 27 and to check the ESC key I use (char)27. Strange...
But anyway, it works now. :)
Thank you very much! (int) works.
I wonder why because when I just use Print(lparam) the result is 187 for the + key.
When I press ESC the result is 27 and to check the ESC key I use (char)27. Strange...
But anyway, it works now. :)
You're welcome. The reason why is because all hex numbers represent binary (which are all integers) - it's low level code...and characters aren't used in binary, it is just 1's and 0's

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey guys,
Can someone tell me why it's not possible to check if + or - is pressed in CHARTEVENT_KEYDOWN?
It doesn't work with if (lparam=='+') and it doesn't work with if (lparam==char(189)) either. But why?
How can I check if these keys are pressed?