Middle Mouse button - Now unrecognised

 

Hi Guys, 

I have a function tied to my middle mouse button.

Up until about an hour ago my middle button function was working, now it's not being recognised at all. 

I've got the following code to recognise any chart events to print their respective ID's out:


   if(id==CHARTEVENT_MOUSE_MOVE)
      {
      
         Print(lparam);
         Print(sparam);
         Print(dparam);
        }


Now nothing appears when the middle button is pressed. I know the mouse button works, i've tested and confirmed. Is anyone else about to see if they get a response from a middle mouse button click? Or point me in the direction of why this might be?

Thx

 
Meta_Work: I have a function tied to my middle mouse button. Up until about an hour ago my middle button function was working, now it's not being recognised at all. I've got the following code to recognise any chart events to print their respective ID's out: Now nothing appears when the middle button is pressed. I know the mouse button works, i've tested and confirmed. Is anyone else about to see if they get a response from a middle mouse button click? Or point me in the direction of why this might be?

Did you try restarting MetaTrader?

Did you try restarting your computer?

What version and build of MetaTrader?

What operation system version?

 
Fernando Carreiro #:

Did you try restarting MetaTrader?

Yes - issue remains.

Did you try restarting your computer?

Yes - issue remains.

What version and build of MetaTrader?

Version 5.00, build 3500

What operation system version?

Windows 10 Pro

10.0.19044


Thanks for helping Fernando :)

I've added comments to your comments if ok :)
 
Meta_Work #: I've added comments to your comments if ok :)

Build 3500 was updated today.

Did you notice if the issue occurred before or after the update to build 3500 occurred?

Try the previous build and see if the issue still occurs or not.

 
Fernando Carreiro #:

Build 3500 was updated today.

Did you notice if the issue occurred before or after the update to build 3500 occurred?

Try the previous build and see if the issue still occurs or not.

It happened just before the new build was released, i remember downloading the latest version in the hope it would fix the issue. 

I'm happy to try a previous version, do you know where i could find it?

 

Thanks to Andrey Khatimlianskii, you can download previous builds here — https://drive.google.com/drive/folders/1YSUVehcElTpLxCLPMsdlDfFu4Y61yrcc

However, probably to the war in the Ukraine, he has not been adding the more recent updates but is up to build 3446 there.

My previous build was 3491, but I'm not able to attach the ZIP file here or send it to you via private message due to the 16MB file limit.

Try the 3446 build first from the link above, just to see if it works, and then we will take it from there.

 

If however, build 3446 does not work for you, please supply a small simple demo code that can be compiled and tested on our end to see it reproduces the issue.

 

Also, remember to keep backups of your files, especially build updates, so that you can revert when things go wrong.

Backups in general is something that you should be doing regularly anyway to safeguard your data.

 
Meta_Work:

Hi Guys, 

I have a function tied to my middle mouse button.

Up until about an hour ago my middle button function was working, now it's not being recognised at all. 

I've got the following code to recognise any chart events to print their respective ID's out:



Now nothing appears when the middle button is pressed. I know the mouse button works, i've tested and confirmed. Is anyone else about to see if they get a response from a middle mouse button click? Or point me in the direction of why this might be?

Thx

i have tested middle mouse button on version 5 build 3500 it works nicely so definitely problem is on your code

 

//+------------------------------------------------------------------+
//|                                             test_MouseMIddle.mq5 |
//|                                                   Copyright 2022 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022"
#property link      ""
#property version   "1.00"
#property indicator_chart_window
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
//--- indicator buffers mapping

//---
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
//---

//--- return value of prev_calculated for next call
   return(rates_total);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) {

   if (id== CHARTEVENT_MOUSE_MOVE ) {
      if(sparam==IntegerToString(16)) {
         Comment("Mouse Middle button clicked");
      }
   }
}
//+------------------------------------------------------------------+
 
Fernando Carreiro #:

Also, remember to keep backups of your files, especially build updates, so that you can revert when things go wrong.

Backups in general is something that you should be doing regularly anyway to safeguard your data.

Good to know, MT4/5 is new to me, so i'll do this for future reference.  Unfortunately, i could download the files, but couldn't install, i tried multiple instances, all the same result.

Here is test code that should print on any mouse movement on the chart, more specifically, print, if the middle button is clicked:

//+------------------------------------------------------------------+
//|                                                     TestCode.mq5 |
//|                                  Copyright 2022, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

  }
  
void OnChartEvent(const int id,         // Event identifier  
                  const long& lparam,   // Event parameter of long type
                  const double& dparam, // Event parameter of double type
                  const string& sparam  // Event parameter of string type
                  )
  {

   if(id==CHARTEVENT_MOUSE_MOVE)
      {
      
         Print(lparam);
         Print(sparam);
         Print(dparam);

         if(sparam == DoubleToString(16,0))
         {
            Print("Middle Button clicked");   
         }
         
      }
   }

Hopefully you see something!

Thanks

 

I created the following test code and ran it on build 3500 and it successfully reported the three regular button states, including the middle button ...

2022.11.12 00:44:28.778 TestMouse (EURUSD,M1)   lparam: 378, dparam: 474, sparame: 0
2022.11.12 00:44:29.349 TestMouse (EURUSD,M1)   lparam: 378, dparam: 474, sparame: 1
2022.11.12 00:44:29.503 TestMouse (EURUSD,M1)   lparam: 378, dparam: 474, sparame: 0
...
2022.11.12 00:44:33.764 TestMouse (EURUSD,M1)   lparam: 396, dparam: 463, sparame: 0
2022.11.12 00:44:33.767 TestMouse (EURUSD,M1)   lparam: 323, dparam: 481, sparame: 2
2022.11.12 00:44:34.895 TestMouse (EURUSD,M1)   lparam: 323, dparam: 481, sparame: 0
...
2022.11.12 00:44:35.783 TestMouse (EURUSD,M1)   lparam: 272, dparam: 455, sparame: 0
2022.11.12 00:44:36.215 TestMouse (EURUSD,M1)   lparam: 272, dparam: 455, sparame: 16
2022.11.12 00:44:36.353 TestMouse (EURUSD,M1)   lparam: 272, dparam: 455, sparame: 0
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

int OnInit() {
   return ChartSetInteger( 0, CHART_EVENT_MOUSE_MOVE, true )
      ? INIT_SUCCEEDED : INIT_FAILED;
};

int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[] ) { return(rates_total); };

void OnChartEvent( const int id,
                   const long &lparam,
                   const double &dparam,
                   const string &sparam ) {
   if( id == CHARTEVENT_MOUSE_MOVE )
      PrintFormat( "lparam: %ld, dparam: %g, sparame: %s", lparam, dparam, sparam );
};
Reason: