Errors, bugs, questions - page 1063

 
MetaDriver:
Try ObjSetInteger(id, Name, OBJPROP_BACK, false);
Tried it. The form does fall backwards, but it does so in the ugliest way possible, i.e. it even falls behind bars. And the task is somewhat different, I just need the text to be displayed in the form, while the form itself was on top of graphics and other forms.
 
C-4:
Tried it. The form does fall backwards, but it does so in the ugliest way possible, i.e. it even falls behind bars. And the task is somewhat different, I just need the text to be displayed in the form, with the form itself being on top of the graphic and other forms.

The objects are displayed in the order they were created, if you want to change the order, you should save the object data and recreate them in the correct order.

Or is the bug even in this?

 
C-4:
Tried it. The form does fall backwards, but it does so in the ugliest way possible, i.e. it even falls behind bars. And the task is somewhat different, you just need the text to be displayed in the form, with the form itself on top of the graphic and other forms.
You just need to consider the order in which the graphic objects are created. The ones that should be below should be created first.
 
tol64:
You just need to take into account the order in which the graphical objects are created. Those that should be lower should be created first.

Yes, that's the first thing I thought of. Changed the order - same result. But there are no miracles. But now I've taken a working project and tried to place OBJ_EDIT there and it worked fine, i.e. it's visible above the form. So, all in all it looks like hell. I obviously forgot or didn't take something into account. But still I wanted to sort it out so that I won't make the same mistake next time. Here is the code of OnInit() for the test:

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
   ObjectCreate(0, "cell", OBJ_RECTANGLE_LABEL, 0, 0, 0);
   ObjectSetInteger(0, "cell", OBJPROP_XDISTANCE, 15);
   ObjectSetInteger(0, "cell", OBJPROP_YDISTANCE, 60);
   ObjectSetInteger(0, "cell", OBJPROP_BGCOLOR, clrWhite);
   ObjectSetInteger(0, "cell", OBJPROP_BORDER_TYPE, BORDER_FLAT);
   ObjectSetInteger(0, "cell", OBJPROP_BORDER_COLOR, clrBlack);
   ObjectSetInteger(0, "cell", OBJPROP_BACK, false);
   //ObjectSetInteger(0, "cell", OBJPROP_SELECTED, false);
   
   ObjectCreate(0, "edittext", OBJ_EDIT, 0, 30, 30);
   ObjectSetInteger(0, "edittext", OBJPROP_XDISTANCE, 40);
   ObjectSetInteger(0, "edittext", OBJPROP_YDISTANCE, 50);
   ObjectSetInteger(0, "edittext", OBJPROP_BGCOLOR, clrNONE);
   ObjectSetInteger(0, "edittext", OBJPROP_BORDER_COLOR, clrNONE);
   //ObjectSetInteger(0, "edittext", OBJPROP_WIDTH, 3);
   ObjectSetString(0, "edittext", OBJPROP_TEXT, "edit text");
   ObjectSetInteger(0, "edittext", OBJPROP_BACK, false);
   
   
   EventSetTimer(1);
//---
   return(INIT_SUCCEEDED);
  }
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов - Документация по MQL5
 
C-4:

Yes, that's the first thing I thought of. Changed the order - same result. But there are no miracles. But now I've taken a working project and tried to place OBJ_EDIT there and it worked fine, i.e. it's visible above the form. So, all in all it looks like hell. I obviously forgot or didn't take something into account. But still I would like to make it out so that I won't make this mistake next time. Here is the code of OnInit() for the test:

In this case, we need an object handler, so that the account of what is created and in what order was in one place, then there will be no overlap when one function creates this second this, and change of function call will change the order.

It's hard to catch this kind of bug and even to foresee it.

 
Info for MQ. In the handbook for OnTimer there is "... to receive by EventSetTimer()...". You should also add "... or EventSetMillisecondTimer()...".
Документация по MQL5: Работа с событиями / EventSetTimer
Документация по MQL5: Работа с событиями / EventSetTimer
  • www.mql5.com
Работа с событиями / EventSetTimer - Документация по MQL5
 

Hello all!

There is a paragraph like this in the help:

Все события обрабатываются одно за другим в порядке поступления. Если в очереди уже есть событие NewTick либо это событие находится в состоянии обработки, то новое событие NewTick в очередь mql5-программы не ставится. Аналогично, если в очереди mql5-программы уже находится событие ChartEvent или такое событие обрабатывается, то новое событие такого типа не ставится в очередь

So, if there's a ChartEvent in the event queue, it shouldn't be queued up a second time. I had a problem with it :)

I drew an Expert Advisor to check it out. It turned out that no matter if there is a ChartEvent event in the queue or not, ChartEvent handler is called as many times as I generate it.

This is great, but in my opinion I need to correct the help... Or am I wrong?

input int N= 50; //количество событий в очереди

void OnInit()
  {
   EventSetTimer(5);
  }

void OnDeinit(const int reason)
  {
   EventKillTimer();    
  }

void OnTimer()
  {
  for (ushort i=0; i<N; i++) EventChartCustom(0,1,i,0,(string)0);
  }


void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   if (id>CHARTEVENT_CUSTOM) Print ("Обработано событие номер: ", lparam);
  }
 
MigVRN:

Hello all!

There is a paragraph like this in the help:

So, if there's a ChartEvent in the event queue, it shouldn't be queued up a second time. I had a problem with it :)

I drew an Expert Advisor to check it out. It turned out that no matter if there is a ChartEvent event in the queue or not, ChartEvent handler is called as many times as I generate it.

This is great, but I think we need to correct the help... Or am I wrong?

This only applies to the case of queue overflow, if the queue is full then the event type that is already in the queue is not placed.

If the queue is not full (and the queue length is 1024 at a guess), all events will be handled.

 
Urain:

This only applies if the queue is full, if the queue is full the event type is already in the queue will not be queued.

But if the queue is not overflowing (and the queue length I think is 1024), then all of the events are handled.

Got it. Thank you :)

PS: The above Expert Advisor failed to queue more than 1000.

 
paladin800:
Info for MQ. In the handbook for OnTimer there is "... to receive by EventSetTimer()...". You should also add "... or EventSetMillisecondTimer()...".
Then everyone will set millisecond timer even if they don't need it...
Reason: