Good afternoon everyone! Sorry for the silly question. Guys, could you please tell me how to make Pressed property of a button to be true when left-clicking and false when left-clicking. Now the situation is such, that nothing happens by pressing it, but Pressed changes its value to the opposite one by releasing it.
I understand that I need to override the CButton::OnMouseUp and CButton::OnMouseDown event handlers, but I have no idea where to do that. A hint please. Thanks in advance!
If anyone can help with the same topic, it would be appreciated.
Aren't you confusing things? There is aCHARTEVENT_CLICK event- a mouse click on a chart; but not a click...
There is, that's right. It's just that the CButton class has two internal event handlers: OnMouseDown() and OnMouseUp(). So I thought, maybe there are corresponding events as well?
Yes, that's right. It's just that the CButton class has two internal event handlers: OnMouseDown() and OnMouseUp(). So I thought, maybe there are corresponding events as well?
I haven't looked at the SB, but apparently there's one press OBJPROP_STATE == true, the other OBJPROP_STATE == false. Or maybe I'm wrong.
Both MT4 and MT5 editors crash when hovering the mouse over "func" in the "int i = func( 0, 1 );" line and selecting the "Go to definition" option (or when pressing Alt+G)
MQL4 build 1910
MQL5 build 1931
template<typename type>
type func( type a, type b = 1 ){ return ( 0 ); }
int i = func( 0, 1 );
voidOnStart(){ }
Not in MQL, not anymore anyway. It's actually twice as slow as reference in debugging, and close enough to the same when compiled normally that it really doesn't matter. Try for yourself.
#define ITERATIONS 1000000voidOnStart()
{
{
ulong time = GetMicrosecondCount();
ulong sum = 0;
for(int i=0; i<ITERATIONS; i++){
string r = string(rand());
sum += by_ref(r);
}
time = GetMicrosecondCount() - time;
printf("%s took %.3f milliseconds: sum=%dll", "by_ref", time/1000.0, sum);
}{
ulong time = GetMicrosecondCount();
ulong sum = 0;
for(int i=0; i<ITERATIONS; i++)
sum += by_val(string(rand()));
time = GetMicrosecondCount() - time;
printf("%s took %.3f milliseconds: sum=%dll", "by_val", time/1000.0, sum);
}
}
//+------------------------------------------------------------------+int by_ref(string &var){ returnint(var) % 100; }
int by_val(string var){ returnint(var) % 100; }
Comrades developers!
In MT4, clicking on the selected graphical object triggers event"CHARTEVENT_OBJECT_DRAG". This is a real error.
In mt5 there is no such a problem.
Good afternoon everyone! Sorry for the silly question. Guys, could you please tell me how to make Pressed property of a button to be true when left-clicking and false when left-clicking. Now the situation is such, that nothing happens by pressing it, but Pressed changes its value to the opposite one by releasing it.
I understand that I need to override the CButton::OnMouseUp and CButton::OnMouseDown event handlers, but I have no idea where to do that. A hint please. Thanks in advance!
If anyone can help with the same topic, it would be appreciated.
If anyone can help with the same topic, it would be appreciated.
The event is only generated when the mouse button is pressed, but not when
The event is generated only when the mouse button is pressed, not when it is clicked
But there is a click handler, isn't there? So there must be a click event.
But there is a press handler, isn't there? So there must be a press event, too.
Aren't you confused? There is CHARTEVENT_CLICK event - mouse click on the chart; but not clicking...
Aren't you confusing things? There is a CHARTEVENT_CLICK event - a mouse click on a chart; but not a click...
There is, that's right. It's just that the CButton class has two internal event handlers: OnMouseDown() and OnMouseUp(). So I thought, maybe there are corresponding events as well?
Yes, that's right. It's just that the CButton class has two internal event handlers: OnMouseDown() and OnMouseUp(). So I thought, maybe there are corresponding events as well?
I haven't looked at the SB, but apparently there's one press OBJPROP_STATE == true, the other OBJPROP_STATE == false. Or maybe I'm wrong.
Forum on trading, automated trading systems and testing trading strategies
MQL equivalent to Python's None type?
nicholi shen, 2018.10.28 21:52
Not in MQL, not anymore anyway. It's actually twice as slow as reference in debugging, and close enough to the same when compiled normally that it really doesn't matter. Try for yourself.
Why is by_ref slower than by_val?