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 suggest adding mouse button status. It won't affect speed, but it can be useful )
I suggest adding mouse button status. It won't affect speed, but it can be useful )
I can't agree, as I don't see much sense in it.
The point is that the status of mouse buttons and keys is an event model, which should be processed only where the occurrence of this event is caught, namely in OnChartEvent.
You are not going to limit an infinite loop of polling the occurrence of some event outside the event handler. So what is the point of putting this status outside OnChartEvent, when all the processing of these clicks should be done in OnChartEvent, the status of which is in lparam and sparam.
Except for the purpose of introducing a new structure of mouse event identifiers to improve code readability.
I can't agree as I don't see much point in it.
The point is that the status of mouse buttons and keys is an event model, which should be handled only where the occurrence of this event is caught, namely in OnChartEvent.
You are not going to limit an infinite loop of polling the occurrence of some event outside the event handler. So what is the point of putting this status outside OnChartEvent, when all the processing of these clicks should be done in OnChartEvent, the status of which is in lparam and sparam.
Except for the purpose of introducing a new structure of mouse event identifiers to improve code readability.
And why store mouse coordinates then? ) Also event-driven )
I didn't understand about the loop...
In particular, I needed the status to avoid drawing a part of the object when dragging with the mouse.
Why store mouse coordinates then? ) Also event-driven )
Mouse coordinates are a different matter. Current mouse coordinates are not event information. The event is their change.
There may be times when mouse coordinates are needed outside OnChartEvent. For example, here.
I didn't understand about the loop...
In particular, the status was needed to avoid drawing a part of the object when dragging with the mouse.
Well, when dragging the mouse, the command to redraw part of the object is called from OnChartEvent at the moment when the mouse coordinate changes and while the mouse is pressed, and OnChartEvent has this status, why embed it in the Window structure?
If you would do the same thing not from OnChartEvent, and at the same time in the instance W of the Window structure there would be MouseStatus, you would have to organise an endless loop of polling of this parameter (MouseStatus) to catch the moment of releasing the mouse button, which would hang the CPU.
This loop is not necessary only in OnChartEvent.
I just want to say that you can and should use the button status only from OnChartEvent, where it is already present.
If I'm wrong, please give me a concrete example where this status would be required not from OnChartEvent.
If I'm wrong, please provide a concrete example where this status would be demanded from something other than OnChartEvent.
I wrote an example above, everything works fine )
In OnChartEvent when moving the mouse we change the parameters and give the command to redraw the canvas. Without a parameter in the structure we would have to pass sparam to an object, from there to another object, and there to the Draw() method.
The mouse coordinates are a different matter. Current mouse coordinates are not event information. The event is their change.
There may be times when mouse coordinates are needed outside OnChartEvent. For example, here.
Well, when you drag the mouse, the command to redraw a part of the object is called from OnChartEvent at the moment when the mouse coordinate changes and while the mouse button is pressed, and OnChartEvent has this status, why embed it in the Window structure?
If you would do the same thing not from OnChartEvent, and at the same time in the instance W of the Window structure there would be MouseStatus, you would have to organise an endless loop of polling of this parameter (MouseStatus) to catch the moment of releasing the mouse button, which would hang the CPU.
This loop is not needed only in OnChartEvent.
I just want to say that you can and should use the button status only from OnChartEvent, which already has it.
If I'm wrong, then give me a concrete example where this status would be required not from OnChartEvent.
Very strange reasoning. There is no logic at all.
Both mouse coordinates and pressed keys are external states. It is passed through parameters to the handler, where if it is put into the internal variables of the object (which is certainly useful), it should be there as a whole, not in parts. A library is by definition something that is made not for one's own needs, but in a generalised form, taking into account the potential needs of others. You can't know all the needs in advance, so you just don't make artificial restrictions like this.
I wrote an example above, everything works fine )
In OnChartEvent when moving the mouse we change the parameters and give the command to redraw the canvas. Without a parameter in the structure we would have to pass sparam to an object, from there to another object, and there to the Draw() method.
This is a classic of the genre - in all window libraries, the states of mouse buttons are passed in a single structure with the cursor coordinates.
because they all together describe one entity and cannot be separately at all.
updated to version 1.29
new:
1. added the following defines for simplicity of code writing and improving readability:
2. added the MouseStatus parameter to the Window structure, which can take 4 values, as requested by the workers: