Problem in creating Panel in MT5.

 

Hello everyone, I have a problem when I create a Panel in MT5 using Dialog library.

I have some elements within my dialog box, when I need to use "Destroy" method to delete some objects within my dialog box and then again use "Create" method to create those objects, when I do that the relation between those objects and the panel disrupts, That means when I move the panel that object does not move proportionally, I ll send a test same to show you my meaning, I ll appreciated if any one can help me, there must be some method or a way to make it right. 


Here when I click BUY button, I want to delete Calculation button, so I use MyCalculator.Destroy();

When I click SELL button, I want to create this button again so I use:

   MyCalButton.Create(0,"MyCalButton",0,SCalButton.X1,SCalButton.Y1,SCalButton.X2,SCalButton.Y2);

   MyCalButton.Text("Calculate");

   MyCalButton.Color(clrWhite);

   MyCalButton.ColorBackground(C'255,102,0');

   MyCalButton.FontSize(FontSize);

   MyCalButton.Font(PanelFont);

   MyCalButton.ColorBorder(clrBlack);

   MyInterface.Add(MyCalButton);

But the now the relation between this button and panel is somehow disconnected, so when I move panel, the button moves disproportionally.



 
I have the same problem. I think the problem is that the same instance of a CButton class is being used again after the Button was destroyed. With my Panel I have problem with a label. I tried to create an instance dynamically inside  a function that handles opening new positions but that doesn't work. Anyone has an idea how to solve this issue? 
Reason: