Errors, bugs, questions - page 2169

 
Sergey Dzyublik:

If my post with a promise to find old code was deleted, it means I didn't promise anything...
Just kidding.


It was written in those dark days (over 3 years ago) when the keyboard functionality was still small and, to put it mildly, unremarkable.
Nowadays, however, as far as memory serves, there are standard features to track the status of a particular key.
So the code snippet below is unlikely to be of any use:

where:
lparam - code of pressed key in current event;
last_key_code - code of the pressed key in the previous event;
g_first_key - code of the first key of the combination;
g_second_key - code of the second key from the combination;
time - time of the current event of the key pressing;
last_time_code - time of previous key press event;
g_time_limit - maximum time between first and second key presses to be considered as a key combination;

my handler does not respond to other keys when Ctrl is pressed, how did this get around?

It's time to go here:https://www.mql5.com/ru/forum/231958

 
I don't know where to go with this problem, but lately when opening or creating a new file Metaeditor hangs tightly, I have to remove the task and start over, can anyone come across and know what to do?
Files:
err.png  132 kb
 
Andrii Djola:
I don't know where to go with this problem, but lately when opening or creating a new file Metaeditor hangs tightly, I have to remove the task and start over, can anyone come across and know what to do?

Good afternoon!

What version of the terminal and what OS do you have installed?

 
Evgeny Chernyshev:

Afternoon!

What version of the terminal and what OS do you have installed?

Win 10 x64

MT5 build 1755 dated 29.01.2018

 
Is there any way to compile the selected source file separately (as before) rather than the project?
 

Am I working out or is it supposed to be like this ?????

   double t   = 280/60;
   string rez = DoubleToString(t,16);
   Print (rez); //  2018.03.18 01:20:57.117	Test (EURUSD_i,H1)	4.0000000000000000

и

   double t   = (double)280/60;
   string rez = DoubleToString(t,16);
   Print (rez); // 2018.03.18 01:21:51.881	Test (EURUSD_i,H1)	4.6666666666666670
 
Vladimir Pastushak:

Am I working too hard or is it supposed to be like this ?????

This is correct (int divides by int, int results in double):

 double t   = 280/60;
 
Sergey Dzyublik:

That's right (int divided by int, int result converted to double):

Thank you!

 
 

Do I understand correctly that this example in the help does not work?

//+------------------------------------------------------------------+ 
//| Expert initialization function                                   | 
//+------------------------------------------------------------------+ 
int OnInit() 
  { 
//--- включение сообщений о прокрутке колесика мышки 
   ChartSetInteger(0,CHART_EVENT_MOUSE_WHEEL,1); 
   return(INIT_SUCCEEDED); 
  } 
//+------------------------------------------------------------------+ 
//| ChartEvent function                                              | 
//+------------------------------------------------------------------+ 
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam) 
  { 
   if(id==CHARTEVENT_MOUSE_WHEEL) 
     { 
      //--- разберем состояние кнопок и колесика мышки для этого события  
      int flg_keys = (int)(lparam>>32);          // флаг состояний клавиш Ctrl, Shift и кнопок мышки 
      int x_cursor = (int)(short)lparam;         // X-координата, в которой произошло событие колесика мышки 
      int y_cursor = (int)(short)(lparam>>16);   // Y-координата, в которой произошло событие колесика мышки 
      int delta    = (int)dparam;                // суммарное значение прокрутки колесика, срабатывает при достижении +120 или -120 
      //--- обработаем флаг  
      string str_keys=""; 
      if((flg_keys&0x0001)!=0) str_keys+="LMOUSE "; 
      if((flg_keys&0x0002)!=0) str_keys+="RMOUSE "; 
      if((flg_keys&0x0004)!=0) str_keys+="SHIFT "; 
      if((flg_keys&0x0008)!=0) str_keys+="CTRL "; 
      if((flg_keys&0x0010)!=0) str_keys+="MMOUSE "; 
      if((flg_keys&0x0020)!=0) str_keys+="X1MOUSE "; 
      if((flg_keys&0x0040)!=0) str_keys+="X2MOUSE "; 
       
      if(str_keys!="") 
         str_keys=", keys='"+StringSubstr(str_keys,0,StringLen(str_keys)-1) + "'"; 
      PrintFormat("%s: X=%d, Y=%d, delta=%d%s",EnumToString(CHARTEVENT_MOUSE_WHEEL),x_cursor,y_cursor,delta,str_keys); 
     } 
  } 

Apart from ctrl and shift and scrolling no other buttons work .....