Visual Performance

 

Hi community,

i have an expert with some gui objects, buttons, editfields, arranged below a rectangle.

When the rectangle is dragged, all the objects in it are moved accordingly.


I run this on MetaTrader 4 as well as on MetaTrader 5. 

The code is pretty similar, except some details.

Now the problem: On MetaTrader 4, it runs smooth.

On MetaTrader 5 not. It sometime takes seconds or even minutes,

before the gui objects within the rectangle, are moved to new position.


In both cases i had more or less the same number of charts opened, forex and 

the same number of my rectangles attached.


The one, MT4 is fine, the other, MT5, not.

The code where all clients are moved, when the rectangle is moved is here:

ClientArray holds all gui object in the rectangle. MoveClients moves all client according their translation. This works fine on MT4 and when i attach 1 rectangle in MT5 and terminal not busy.
   virtual void OnChartEvent(int id,long lp,double dp,string sp)   
   {
      
      switch(id)
      {
         case CHARTEVENT_KEYDOWN:
         {
         }break;
         case CHARTEVENT_MOUSE_MOVE:
         {
                        if(sp == MOUSE_LB_BUTTON_DOWN_STR 
                                && ClientArray.mouse_in_object((int)lp,(int)dp) == false // mouse over one of the gui objects
                                && mouse_in_object((int)lp,(int)dp) == true  // mouse over rectanlge
                                )
                        {
                MoveClients((int) lp,(int) dp,sp);
                                ChartRedraw();
                        }
                        
         }break;
         case CHARTEVENT_OBJECT_DRAG:
         {
            if(sp == name())
            {
                // save this positions and all client positions
               SavePosition();
               ChartRedraw();
            }
         }break;
         
      }
     
   }  

Any hint appreciated.

 
MT4 is not MT5, you have to debug your code to find where the problem is.