Next time, please use SRC button when you post code. I edited it for you.
From my experience CHARTEVENT_KEYDOWN isn't reliable to detect key combination inputs.
Your code works well if you press <Ctrl+J>, then release all, then press <Ctrl+Q>, then release all... But normal behavior (in any Windows program) like pressing <Ctrl> then <J>, releasing J key, then press <Q>, all of that keeping <Ctrl> pressed, doesn't work and can't be detected.
I already report this to ServiceDesk (#826140), but without success, their reply was :
You should analyze the value of the sparam for event CHARTEVENT_KEYDOWN as it said in MSDN (http://msdn.microsoft.com/en-us/library/983st27a%28v=vs.90%29.aspx)
Event |
Value of the id parameter |
Value of the lparam parameter |
Value of the dparam parameter |
Value of the sparam parameter |
Event of a keystroke |
CHARTEVENT_KEYDOWN |
code of a pressed key |
Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key) |
The string value of a bit mask describing the status of keyboard buttons |
But I can't find a way to have it working well. So my opinion is that there is no reliable way to detect correctly combination of keys input. I would be happy if some can demonstrate that I am wrong.
![CWnd::OnKeyDown CWnd::OnKeyDown](https://c.mql5.com/36/3/cwnd-onkeydown.png)
- msdn.microsoft.com
Next time, please use SRC button when you post code. I edited it for you.
From my experience CHARTEVENT_KEYDOWN isn't reliable to detect key combination inputs.
Your code works well if you press <Ctrl+J>, then release all, then press <Ctrl+Q>, then release all... But normal behavior (in any Windows program) like pressing <Ctrl> then <J>, releasing J key, then press <Q>, all of that keeping <Ctrl> pressed, doesn't work and can't be detected.
I already report this to ServiceDesk (#826140), but without success, their reply was :
But I can't find a way to have it working well. So my opinion is that there is no reliable way to detect correctly combination of keys input. I would be happy if some can demonstrate that I am wrong.
Hi,
Noted on the SRC button. The detection of <Ctrl+J> is quite reliable so far. see the test program link . The issue is the execution of code inside the <Ctrl+J> is not done properly.
Regards,
Toyogo
Hi,
Noted on the SRC button. The detection of <Ctrl+J> is quite reliable so far. see the test program link . The issue is the execution of code inside the <Ctrl+J> is not done properly.
Regards,
Toyogo
Nope. I tried your code and it's working well. If use press <Ctrl+J> all 5 lines are displayed, if I press <Ctrl+Q> all 5 lines are removed.
The detection of <Ctrl+J> isn't always reliable. If I press <Ctrl> and keep it pressed, then I press <Q>, lines are removed, if I then press <J>, lines are not displayed. <Ctrl+J> is not detected. Anyway, it's probably not related to your issue, and I understand that it's sufficiently reliable for your need.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I found this link on how to use hotkey programming. I further use the hotkey to turn on/off the display of VLINE for US/UK session on hourly or below chart. See code:
It works but 2 issues:
a. After pressing Ctrl-J, I have to shift the screen using mouse in order to view the vLine.
b1. I have to press Ctrl-J two times to display all 5 vLines. The 1st Ctrl-J displays only sTime[0-3] and the next Ctrl-J displays sTime[4].
b2. likewise, I also have to press Ctrl-Q two times to turn off the 5 vlines.
Pls advise!
Regards,
Toyogo