CHARTEVENT_KEYDOWN keystrokes And various keyboards

 

I'd like to use CHARTEVENT_KEYDOWN with the event handler OnChartEvent(), To detect keystrokes and assign them to functions, 

I'm noticing that the keys are not the same depending on the type of keyboard used in Windows (AZERTY / QWERTY / QWERTZ) and also the lparam codes.

How do you manage this type of problem pls?

One of the first solutions I came up with was to find the keys common to all 3 types of keyboard. I based myself on this link, So I've chosen this list: 

e, r, t, u, i, o, p, s, d, f, g, h, j, k, l, x, c, v, b, n  
#define KEY_LEFT          37
#define KEY_UP             38
#define KEY_RIGHT        39
#define KEY_DOWN        40
#define KEY_E    69
#define KEY_R    82
#define KEY_T    84
#define KEY_U    85
#define KEY_i    73
#define KEY_O    79
#define KEY_P    80
#define KEY_S    83
#define KEY_D    68
#define KEY_F    70
#define KEY_G    71
#define KEY_H    72
#define KEY_J    74
#define KEY_K    75
#define KEY_L    76
#define KEY_X    88
#define KEY_C    67
#define KEY_V    86
#define KEY_B    66
#define KEY_N    78


but it's still a problem because you can have other keyboards, such as Chinese or Arabic. 

Thank you in advance for your leads and insights.

 
Nothing?
 
You could also have a setup mode where the user sets up (or in this case changes) the combinations for executing functions . 
 
ZeroCafeine: I'd like to use CHARTEVENT_KEYDOWN with the event handler OnChartEvent(), To detect keystrokes and assign them to functions, I'm noticing that the keys are not the same depending on the type of keyboard used in Windows (AZERTY / QWERTY / QWERTZ) and also the lparam codes. How do you manage this type of problem pls? One of the first solutions I came up with was to find the keys common to all 3 types of keyboard. I based myself on this link, So I've chosen this list: e, r, t, u, i, o, p, s, d, f, g, h, j, k, l, x, c, v, b, n. but it's still a problem because you can have other keyboards, such as Chinese or Arabic. Thank you in advance for your leads and insights.

That is just how it is! The key codes do not directly translate into characters. That is why operating systems have multiple keyboard templates to choose from.

Follow the advice given by @Lorentzos Roussos and let the user choose their own keyboard shortcuts.

 
Lorentzos Roussos #:
You could also have a setup mode where the user sets up (or in this case changes) the combinations for executing functions . 

That's right, I hadn't thought of that, thank you 😉


as I only program for myself, I don't think I'll be using input for the time being, but thanks again for your idea.

 
Fernando Carreiro #:

That is just how it is! The key codes do not directly translate into characters. That is why operating systems have multiple keyboard templates to choose from.

Follow the advice given by @Lorentzos Roussos and let the user choose their own keyboard shortcuts.

Thanks for your reply Fernando, I'm not planning to market my work, so I'm not going to play around with inputs for the time being, but thanks again for the idea,

Do you know if it's possible to use shortcuts like Ctlr + Shirt + C + F1 ?

I'm afraid I'll type on my keyboard unintentionally and end up with orders I didn't want, 

I think a complicated shortcut like Ctlr + Shirt + C + F1 would be ideal to avoid typing errors, but I don't think it's possible, 

can you confirm this or do you have any other ideas to suggest? 

Best Reguards,
ZeroCafeine

 
ZeroCafeine #:

Thanks for your reply Fernando, I'm not planning to market my work, so I'm not going to play around with inputs for the time being, but thanks again for the idea,

Do you know if it's possible to use shortcuts like Ctlr + Shirt + C + F1 ?

I'm afraid I'll type on my keyboard unintentionally and end up with orders I didn't want, 

I think a complicated shortcut like Ctlr + Shirt + C + F1 would be ideal to avoid typing errors, but I don't think it's possible, 

can you confirm this or do you have any other ideas to suggest? 

Best Reguards,
ZeroCafeine

I think you can do it but you have to manage the "combos" yourself , delays , press duration and all . And these buttons change their event signature when held down (lparam,dparam,sparam)

 

ok thanks a lot, I don't mind managing combos from several toche, as I use a stream deck, As you can see in the screenshot

SD

 

@ Lorentzos Roussos

If you have a link or an example for the combo keys, I'm interested 😊 . 


Best Reguards

Lorentzos Roussos
Lorentzos Roussos
  • 2023.11.03
  • www.mql5.com
Trader's profile
 
ZeroCafeine #:

@ Lorentzos Roussos

If you have a link or an example for the combo keys, I'm interested 😊 . 


Best Reguards

I'll look it up when i get out of the sauna

 
Lorentzos Roussos #:

I'll look it up when i get out of the sauna

tks you 😉

Reason: