Get the mouse Y value

Created at 26 Jun 2024, 19:25
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CI

cindyarhodia

Joined 31.05.2024

Get the mouse Y value
26 Jun 2024, 19:25


Hello everyone,

I'm adding hotkeys support in a trade assistant I'm dev'ing and I was wondering what's the best way to add horizontal lines on the chart when a KeyDown event gets fired.

I want the line to appear at Y value of the mouse cursor. Right now I store this value in a class variable and update it whenever the MouseMove event occurs but I noticed a small sync delay, if I move it pretty fast and press my hotkey to draw a line, sometimes the line won't be drawn at the right level.

Maybe there is a better way to get the mouse Y value inside my KeyDown event handler that would reduce the delay and give a more accurate level ?

Tyvm <3


@cindyarhodia