![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I found this code for checking mouse position on Mouse Left DOWN and Mouse Left UP
Lets say I have a button named "My Button"
How I can set action to this button using the code above.
Consult this code maybe it will give you an idea of how your structure should be.
@Lorentzos Roussos Thank you. It does what I need. How I can modify the code to use with multiple objects.
You will need to keep a log of all your objects (mostly buttons) with an is_hovered switch , is_clicking switch ,from_x,from_y,to_x,to_y coordinates
and run through them on each mousemove event execution.
The difference is that if any one of the buttons "is clicking" the rest are not interactable.
Pair that with the ability to change the bitmap label and you have a system where the buttons "light up" and stay "lit" ( xD ) when being clicked.
Beware though as in huge deployments you will need to enforce delays and cancel outs of the mouse click to avoid misfires or double execution.
You will need to keep a log of all your objects (mostly buttons) with an is_hovered switch , is_clicking switch ,from_x,from_y,to_x,to_y coordinates
and run through them on each mousemove event execution.
The difference is that if any one of the buttons "is clicking" the rest are not interactable.
Pair that with the ability to change the bitmap label and you have a system where the buttons "light up" and stay "lit" ( xD ) when being clicked.
Beware though as in huge deployments you will need to enforce delays and cancel outs of the mouse click to avoid misfires or double execution.
@Lorentzos Roussos I played arround and was able to get what I want, i.e.
Changed button state by mouse click
And reset on mouse release
So what I am trying to figure out is to cancel the action if the mouse release was outside of the button. So, where should put the execution code to make it work only if the mouse button was released on the button.
You will need to keep a log of all your objects (mostly buttons) with an is_hovered switch , is_clicking switch ,from_x,from_y,to_x,to_y coordinates
and run through them on each mousemove event execution.
Can you please show a code sample for two different objects.
Can you please show a code sample for two different objects.
No
Then you will go to the section that controls execution here :
and specify if the button is no longer hovered on release then dont do whats supposed to be done
@Lorentzos Roussos you are genious.
Is it possible to put execution code on hovering (without click)?
@Lorentzos Roussos you are genious.
Is it possible to put execution code on hovering (without click)?
For effects ? yes