CHART_AUTOSCROLL according the mouse wheel - page 2

To add comments, please log in or register
Thierry Ramaniraka
535
Thierry Ramaniraka  
Thank you very much .

kypa:

The wheel click is assigned for haircross so you may run into conflict (sometimes your functions execute, sometimes a crosshair appears).

I want both of these functions, the orginal cross hair, and my custom fonction.

kypa:

If you want to use the scroll wheel it's the same procedure with id==CHART_EVENT_MOUSE_WHEEL and lparam. Except you need Build 1121, because Build 1090 doesn't support it. 

How can I force update it please ?


kypa
981
kypa  

Just register a demo account at MetaQuotes-Demo server from terminal (File/Open account) and it will update.

Unless you're running XP or Vista, then it won't update.

Lorentzos Roussos
23102
Lorentzos Roussos  

Kypa is right . Try this as well (althought it may be firing due to MouseWheel event ) 

bool CrosshairMode=false;
int OnInit()
  {
  CrosshairMode=false;
  ClickAndScroll=false;
  ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
  ChartSetInteger(0,CHART_KEYBOARD_CONTROL,true);
//--- create timer

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
  // EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
long fvb,cvb,prefvb,precvb,change,pre_change;
bool block_wheel=false;
int mcx,mcy,pre_mcx,pre_mcy;
string pre_sparam;
bool ClickAndScroll=false;
bool afterBlock=false;
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
    block_wheel=false;
    if(id==CHARTEVENT_CLICK) block_wheel=true;
    if(id==CHARTEVENT_KEYDOWN) block_wheel=true;
    //mousemove  
    if(id==CHARTEVENT_MOUSE_MOVE)
    {
    mcx=(int)lparam;
    mcy=(int)dparam;  
    int wid=(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
    int hei=(int)ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
    //Scrolling
      if(sparam!="1"&&ClickAndScroll==true)
       {
       ClickAndScroll=false;
       block_wheel=true;
       }
      if(sparam=="1"&&ClickAndScroll==false&&mcx>=0&&mcx<=wid&&mcy>=0&&mcy<=hei)
       {
      if(pre_sparam!="1"&&pre_mcx>=0&&pre_mcx<=wid&&pre_mcy>=0&&pre_mcy<=hei)
       {
       ClickAndScroll=true; 
       }
       }
    //if scrolling is on  
      if(ClickAndScroll==true)
      {
      block_wheel=true;
      }
    //if scrolling is on ends here 
    pre_mcx=MathAbs(mcx);
    pre_mcy=MathAbs(mcy);
    pre_sparam=StringConcatenate(sparam);
    //click and scroll Ends Here        
    }
    //mousemove ends here 
    fvb=ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);
    cvb=ChartGetInteger(0,CHART_VISIBLE_BARS,0);
    change=(fvb-prefvb)+(cvb-precvb);
    precvb=cvb;
    prefvb=fvb;
    if(block_wheel==false&&ClickAndScroll==false&&afterBlock==false)
    {
    if(change!=0) Print("Wheel : "+IntegerToString(change));
    }
    pre_change=change;
    if(block_wheel==true) afterBlock=true;
    if(block_wheel==false&&afterBlock==true) afterBlock=false;
  }
//+------------------------------------------------------------------+
Thierry Ramaniraka
535
Thierry Ramaniraka  
kypa:

Just register a demo account at MetaQuotes-Demo server from terminal (File/Open account) and it will update.

Unless you're running XP or Vista, then it won't update.

Lorentzos Roussos:

Kypa is right . Try this as well (althought it may be firing due to MouseWheel event ) 

Ok,
I will work on it.

Thank you very much.

Thierry Ramaniraka
535
Thierry Ramaniraka  
kypa:

Just register a demo account at MetaQuotes-Demo server from terminal (File/Open account) and it will update.

Unless you're running XP or Vista, then it won't update.

IT doesn't work. :-/
Does not allow me to go on.


And tried to real account from meta quotes server too...
But still the same old version... :-/

kypa
981
kypa  

There are no real accounts from MetaQuotes.

Write longer name and bogus e-mail. And random numbers for phone, not just zeros.

What OS do you have?
Thierry Ramaniraka
535
Thierry Ramaniraka  
kypa:

There are no real accounts from MetaQuotes.

Write longer name and bogus e-mail. And random numbers for phone, not just zeros.

What OS do you have?

It's ok now.
Thank you very much.

12
To add comments, please log in or register